Probe an input device's analog levels and digital signals" for that I will use the serial plotter tool
GET STARTEDvoid setup() { Serial.begin(9600); } // the loop routine runs over and over again forever: void loop() { int sensorValue = analogRead(A0); Serial.println(sensorValue); delay(1); }
If we want to take the voltage out of the analog pin, then we only need to device the value that comes from it to 204.6 ---->so the you need to change the code to "Serial.println(sensorValue/204.6)" , with that, the plotter will show the voltage of A0 pin:
Again this time but with digital signal from the proximity ir sensor , you can find more details about it below in this page... anyway for the graou assessment, let's play some digital signal as well.
as you know, digital is 0,1 only, so if the proximity sensor is sensing something nearby, then it will give 1, if not, then the signal will be 0, and that is what I got in the plotter:
and thecode is very similar to the last one, but this time ,we are reading a digital signal:
void setup() { Serial.begin(9600); } // the loop routine runs over and over again forever: void loop() { int sensorValue = digitalRead(5); Serial.println(sensorValue); delay(1); }
Copyright © 2016 Minimax Digital Firm - Design: Tooplate