You are reading a single comment by @DaveNI and its replies.
Click here to read the full conversation.
-
Just because you have nothing at all connected to an input pin doesn't mean it is a logical zoro.
To ensure that inputs default to expected logic levels you need to use pullup or pulldown resistors. See this link for an explanation:
http://playground.arduino.cc/CommonTopics/PullUpDownResistor
Hi all
I am new to Espruino and is just starting something what will hopefully be a lot of fun.
So to start simple I have mounted Espruino on a breadboard and measuring voltage by connecting + on the battery to C0 and - to GND and then execute:
setInterval(function(){console.log(analogRead(C0)*E.getAnalogVRef());},250);
... on a AA battery (1,2 V) I measure a value around 1,3 (, used in DK, maybe for you 1.3).
However, when I remove the battery there are still some measurements, should there be?
Example output without battery:
0.67295681063
0.89780730897
2.78936170212
0.87308970099
2.98164893617
0.65816733067
0.86613545816
2.80983388704
0.84438538205
2.89468085106
0.71665560716
0.85554817275
2.88558139534
0.80850498338
1.68605577689
0.77740863787
0.82604651162
2.93058510638
0.81727574750
1.13138297872
0.77023255813
0.84757475083
2.96489361702
0.83800664451
1.00624584717
2.55388704318
0.83720930232
2.93581395348
0.75109634551
0.89780730897
2.81700996677
Example output with battery, which suggest actual reading:
1.38510638297
1.38430851063
1.38498338870
1.38590425531
1.38351063829
1.38430851063
1.38430851063
1.38351063829
1.38590425531
1.38430851063
1.38430851063
1.38259136212
1.38326693227
1.38430851063
1.38430851063
1.40026595744
1.38430851063
1.38259136212
1.38259136212
1.38590425531
1.38430851063
1.38430851063
1.38510638297
1.38510638297
1.38430851063
How come?
Thanks