Go Down

Topic: Project 3 Love-O-Meter issue (Read 1 time) previous topic - next topic

parvenu05

I opened Arduino and typed up the code for the project. The code was verified, however, when I upload the project onto the Arduino board all the lights light up, which should only happen when I touch the sensor. Instead, it does it by itself. How can  I can I tell if the sensor is bad. I redid all the connections on the breadboard and it does the same thing. I used the project source code that was provided on the Program, So I know it maybe a problem with some type of a connection. But if it is the sensor, how can I tell?. The system log says the temperature is at or around 30 C.

TheKlap

The problem isn't the circuit or components, it's most likely the code.

const float baselineTemp = 20.0;

This variable is the base temperature that the Arduino measures the temperature from. Since the system log says that the ambient temperature of the room is 30C, you need to change the baselineTemp to a higher number. Changing this number will ensure that the base temperature that the arduino measures is 30C instead of 20C.

This also applies if the ambient temperature was below 20C, in which you'd have to change the baselineTemp to a lower value.

Your sensor if fine, so you got nothing to worry about   :D

Fensu

To add to what TheKlap mentioned, the code in the book basically says "for every 2 degrees above 20C, turn on another light". Since your room is 30C, all 3 lights turn on. Change the baselinetemp like TheKlap pointed out and you should be good.

Go Up