Go Down

Topic: Project #3 for() loop mystery (Read 62 times) previous topic - next topic

confused1

I've assembled and coded project #3 "love-o-meter" but am having trouble with for()loop.

everything seems to be in order. except that the only way I can get it to appear to work properly is if I change my for() loop.

The book says to  code:

for(int pinNumber = 2; pinNumber<5; pinNumber++){
pinMode(pinNumber,OUTPUT);
digitalWrite(pinNumber, LOW);

However the LED's wont light unless I make one change last line to

digitalWrite(pinNumber, HIGH);

I then also need to change my baselineTemp to =13 rather than the actual 16C of room temp.

If I do these things it seems to operate exactly as its meant to.

I should note that  the Serial Monitor is indicating everything is normal. The TMP is sensing around 16C.

I've been over the code several times and even disassembled and reassembled the circuit. Its also worth noting that I completed this project without this problem yesterday and only decided to revisit today for the practice. I am baffled!!

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy