Activity › Forums › Questions & Troubleshooting › Software & Firmware › Is there something wrong with my Controllino?
-
Is there something wrong with my Controllino?
-
Problem is from Porting Arduino code…(https://community.controllino.com/forums/discussion/porting-arduino-code/) that I posted but it looks like you only get one replay and then none reads it anymore.
I can’t make my Controllino to use analog outputs… I attempted even this code to troubleshoot:
#include <Controllino.h>
int outputPin = CONTROLLINO_AO0;
int testPin = A0;
void setup() {
// put your setup code here, to run once:
pinMode(outputPin, OUTPUT);
pinMode(outputPin, CONTROLLINO_AO1);
pinMode(testPin, INPUT);
analogWrite(CONTROLLINO_AO1, 1);
analogWrite(CONTROLLINO_AO1, 1);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(testPin)){
analogWrite(outputPin, 255);
analogWrite(CONTROLLINO_AO1, 255);
}
if (!(digitalRead(testPin))){
analogWrite(outputPin, 1);
analogWrite(CONTROLLINO_AO1, 1);
}
}
then this…
#include <Controllino.h>
int outputPin = 12;
int testPin = A0;
void setup() {
// put your setup code here, to run once:
pinMode(outputPin, OUTPUT);
pinMode(outputPin, 13);
pinMode(testPin, INPUT);
analogWrite(outputPin, 1);
analogWrite(13, 1);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(testPin)){
analogWrite(outputPin, 255);
analogWrite(13, 255);
}
if (!(digitalRead(testPin))){
analogWrite(outputPin, 1);
analogWrite(13, 1);
}
}
And it is not working. It is turning DI2 and DI3 on… AO0 is on 1.12V always and AO1 is 0V always… But DI2 and DI3 are changeing from 0 to 5V…
And for some reasen I get an error if I use 0 in analogWrite(13, 1) but can use analogWrite(outputPin, 0)… I find that strange…
I’m at a point thinking there is something wrong with my Controllino… Am I right?
-
I copy/pased old code with a bug… This two part were fixed…
// put your setup code here, to run once:
pinMode(outputPin, OUTPUT);
pinMode(CONTROLLINO_AO1, OUTPUT);
pinMode(testPin, INPUT);
analogWrite(outputPin, 1);
analogWrite(CONTROLLINO_AO1, 1);
And
// put your setup code here, to run once:
pinMode(outputPin, OUTPUT);
pinMode(13, OUTPUT);
pinMode(testPin, INPUT);
analogWrite(outputPin, 1);
analogWrite(13, 1);
-
Hello Lucko,
I am sorry for a late reply. I have tested your code (also placed below in my comment) with my CONTROLLINO MAXI Automation and it works fine and as expected.
- MAXI is powered from 24VDC
- I measure 0,04 V at AO0
- When I connect 24 V to AI0 then only AI0 LED is ON
- And I can measure 10,09 V at AO0
Please note that I can use value 0 for analogWrite without any problems.
So, maybe there is really something wrong with your device, but it may be also something with your compilation toolchain … please share with us the verbose output of the compilation when you observe the issue with the value 0.
#include <Controllino.h>
int outputPin = 12;
int testPin = A0;
void setup() {
// put your setup code here, to run once:
pinMode(outputPin, OUTPUT);
pinMode(13, OUTPUT);
pinMode(testPin, INPUT);
analogWrite(outputPin, 0);
analogWrite(13, 0);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(testPin)){
analogWrite(outputPin, 255);
analogWrite(13, 255);
}
if (!(digitalRead(testPin))){
analogWrite(outputPin, 1);
analogWrite(13, 1);
}
}Thanks,
Lukas
-
Hi!
At the moment I can use 0 too. No idea what was wrong before. It might be a bug that we had and fixed… So I’m guessing it was me not setting pinMode… I’m more then happy to give you any additional data or screenshots if you need it it or run any program on a unit…
Regards
- This reply was modified 3 years, 7 months ago by Lucko.
-
Hi Lucko,
please share with us your test setup wiring – a drawing or photo will be great!
Thanks,
Lukas
-
You got them over the mail… You stopped answering to mails again(web form and “massaging app” on your page) so this is my last attempt before I will ask for my money back and find a different solution.
-
Log in to reply.