Hi,
Thanks for helping.
I reproduced the arduino code, added some lines
Serial.begin(9600); Serial.print(" Volts: "); Serial.print(Volt); Serial.print(", Temperature: "); Serial.println(Temperature); .
I noticed the voltage equals zero but when i upload the official code the voltage is correctly gauged.
See the video : on right the IDE with the official code, on left the IDE with your code.
Very strange.
https://www.swisstransfer.com/d/32cbdf92-ac81-4f28-a08b-11b94f655cca
float Temperature = 0;
float Volt = 0;
float temperatureRef = 0;
void _delay(float seconds) {
long endTime = millis() + seconds * 1000;
while(millis() < endTime) _loop();
}
void setup() {
//added
Serial.begin(9600);
pinMode(A0+0,INPUT);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
while(1) {
temperatureRef = 21;
Volt = (analogRead(A0+0) / 1024) * 5;
//added from the example
//Send the voltage level out the Serial port
Serial.print(" Volts: ");
Serial.print(Volt);
Temperature = ((Volt - 0.5)) * 100;
//added et new line
Serial.print(", Temperature: ");
Serial.println(Temperature);
if(Temperature > (temperatureRef + 6)){
digitalWrite(2,1);
digitalWrite(3,1);
digitalWrite(4,1);
}else{
if(Temperature > (temperatureRef + 4)){
digitalWrite(2,1);
digitalWrite(3,1);
digitalWrite(4,0);
}else{
if(Temperature > (temperatureRef + 2)){
digitalWrite(2,1);
digitalWrite(3,0);
digitalWrite(4,0);
}else{
digitalWrite(2,0);
digitalWrite(3,0);
digitalWrite(4,0);
}
}
}
_delay(1);
_loop();
}
}
void _loop() {
}
void loop() {
_loop();
}