Skip to content

Instantly share code, notes, and snippets.

@woodif woodif/ADC.ino
Created Jul 15, 2015

Embed
What would you like to do?
/*
Analog input, analog output, serial output
*/
// These constants won't change. They're used to give names
// to the pins used:
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
int sensorValue = 0; // value read from the pot
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(115200);
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
// print the results to the serial monitor:
Serial.print("sensor = " );
Serial.println(sensorValue);
delay(50);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.