Just for reference here's the sample code I'm using. I'm using one of the sample circuits provided with the kit and this is the sample modified to print the values. I did this because I couldn't get the sample circuit to work.
Code: Select all
int potPin = 2; // select the input pin for the potentiometer
int ledPin = 9; // select the pin for the LED
int val = 0; // variable to store the value coming from the sensor
void setup() {
pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
Serial.begin(9600);
}
void loop() {
int threshold = 512;
val = analogRead(potPin); // read the value from the sensor
analogWrite(ledPin, val); // turn the ledPin on
Serial.println(val);
}