// This code assumes the Grove Light Sensor is attached to A0 (Analog Port 0)
// and the LED Bar is attached to D2 (Digital Pin 2)
// Getting started for Grove - Light Sensor
#include <Grove_LED_Bar.h>
Grove_LED_Bar bar(3, 2, 0); // Clock pin, Data pin, Orientation
void setup()
{
// nothing to initialize
bar.begin();
bar.setGreenToRed(true);
}
void loop()
{
int value = analogRead(A0);
value = map(value, 0, 800, 0, 10);
bar.setLevel(value);
delay(100);
}