Published

COI - Light Transmission Meter

The finished product uses the light sensor provided in the Grove Starter Kit Plus to measure change in light intensity.

Full instructions provided250
COI - Light Transmission Meter

Things used in this project

Hardware components

Intel Edison
Intel Edison
×1
LED (generic)
LED (generic)
×1
Grove - Digital Light Sensor
×1
Grove - LCD RGB Backlight
×1

Story

Read more

Code

Code

Plain text
void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT);
  analogWrite(ledPin, maxBrightness);
  lcd.begin(16,2);//Configure the number of rows and columns on the lcd screen
  lcd.setRGB(255,255,255);
}

Code

Plain text
void loop() {
  if(digitalRead(buttonPin)==HIGH){
    maxLightIntensity = analogRead(lightPin);
  }
  double percent = 100*((double)analogRead(lightPin))/maxLightIntensity;
  lcd.setCursor(0,0);
  lcd.print("                ");//Clear LCD screen
  lcd.setCursor(0,0);
  lcd.print("Percent: ");
  lcd.print(percent);
  lcd.print("%");
  delay(100);
}

Credits

Comments