Input Devices

Group  Assignment

Probe an input device's analog levels and digital signals" for that I will use the serial plotter tool

GET STARTED

Probe an input device's analog levels and digital signals

Arduino   Arduino

let's use an analog serial monitoring code , that will read the analog signal from a potentiometer connected to A0, and plot it using the IDE arduino, check the code:

				
				

void 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:

Arduino

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:

Arduino

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); }



Keep in touch

TalentS Lab is owned by National Talents Company