Analog Sensor

  1. Click the Arduino program link
  2. 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);
    }
  3. Save the file: File -> Save As: AnalogSensor
  4. Open the console view window: Tools -> Serial Monitor
  5. Compile the sketch:  
  6. Upload (transfer) the sketch to the card:  
  7. View the output in the COM window.
  8. Hold your finger over the light sensor (A6)
  9. Watch the output change
  10. Change the program so that it reads the temperature sensor (A1).
    1. edit the sensor number
    2. compile
    3. upload
    4. view the output
    5. try to change the temperature reading of the sensor
  11. Close the Serial Window
  12. 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