Grove - Light Sensor
This project will use a Grove Light Sensor to turn on a Grove LED when light in the room is above a threshold value.
- Connect a Grove LED to a grove connector on your board and a Grove Light Sensor.
- Begin a new Grove project using the Grove Project Import method at the bottom of this page.
- In the Project Explorer on the left, under Sources, double click to open the file "arduinoApp.cpp".
- Copy and paste the following code into this file to replace it's contents:
//--------- Light Sensor Test #include "arduinoApp.h" #define THRESHOLD_VALUE 15000 // The threshold to turn the led on int lightSensorPin = 0; // Sensor connected to this analog pin void setup() void loop() |
- Select Project from the main menu and choose Build Project.
- If there are any errors they will be displayed in the Problems tab.
Now follow the steps under Debugging your ARM Board Project.