Analog Sensor
- Click the Arduino program link
- Type this code into the window (this is a sketch or program)
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A6); // A1=temperature, A6=light
Serial.println(sensorValue);
delay(1);
}
- Save the file: File -> Save As: AnalogSensor
- Open the console view window: Tools -> Serial Monitor
- Compile the sketch:
- Upload (transfer) the sketch to the card:
- View the output in the COM window.
- Hold your finger over the light sensor (A6)
- Watch the output change
- Change the program so that it reads the temperature sensor (A1).
- edit the sensor number
- compile
- upload
- view the output
- try to change the temperature reading of the sensor
- Close the Serial Window
- Close the program file and go to program 2
There are lots of example sketches to try, and more information online at: https://www.arduino.cc/en/Guide/ArduinoLilyPad