analog-read.ino
1 // SPDX-FileCopyrightText: 2018 Anne Barela for Adafruit Industries 2 // 3 // SPDX-License-Identifier: MIT 4 5 // Simple read analog potentiometer on Circuit Playground Express or other board with pin change 6 // Anne Barela for Adafruit Industries 9/2018 7 8 #define ANALOGPIN A1 // For Circuit Playground Express 9 10 int delayval = 500; // delay for half a second 11 12 void setup() { 13 Serial.begin(9600); // open the serial port at 9600 bps 14 } 15 16 void loop() { 17 int value; 18 19 value = analogRead(ANALOGPIN); // analog read of potentiometer 20 21 Serial.println(value); // print value 22 23 delay(delayval); // Delay for a period of time (in milliseconds). 24 }