/* 03/09/2021 analogReadv1 Board used Arduino UNO Basics of reading from an analogue pin Connect pin A5 to 5v, then try connecting to 3.3v, then to Gnd to see the values change Previous lessons used in this sketch: lesson 2 "Hello World" Basics of printing to Serial Window http://www.digitaltown.co.uk/lesson2helloworld.php Lesson 6 boolean, byte, int, long, unsigned int, unsigned long http://www.digitaltown.co.uk/lesson6bitsandbytes.php */ //Variables //The variable that will store the returned value int readPin; //A const int with the pin number const int analogPin = A5; void setup() { Serial.begin(9600); Serial.println("analogReadv1"); Serial.println(" "); } void loop() { //Reads the voltage on the in steps of 0-1023 //5v on UNO gives 1023 //3.3v on UNO gives 681/682 //0v gives 0 //Connecting to nothing gives a floating value. readPin = analogRead(analogPin); Serial.println(readPin); delay(300); }