/* Read the photo sensor on EduBase V2. * On EduBase V2, the photo sensor is connected to pin A0. * The conversion result is sent to the Serial monitor. * Cover the photo sensor or shine a flashlight on it and see the value changes. */ // Pin A0 is connected to a photo sensor const int photo = A0; void setup() { Serial.begin(9600); Serial.println("Photosensor:"); } void loop() { /* read the voltage from ADC */ int photoValue = analogRead(photo); /* write it to the Serial monitor */ Serial.print(" Photosensor value = "); Serial.println(photoValue, DEC); }