Quality,
Affordable,
Manufacturing
& Design
Services
- Turn Key Assembly
- Parts Acquisition
- Box Build
- System Assembly
- Functional Testing



- PCB Assembly
- Surface Mount
- Through Hole
- BGA, uBGA, LGA
- Prototype and Production
- Re-Work and Repair


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.


  1. Connect a Grove LED to a grove connector on your board and a Grove Light Sensor.
  2. Begin a new Grove project using the Grove Project Import method at the bottom of this page.
  3. In the Project Explorer on the left, under Sources, double click to open the file "arduinoApp.cpp".
  4. 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
int ledPin = 4;             // LED connected to this digital pin number
int sensorValue;           // variable to store the value read

void setup()
{
    pinMode(ledPin, OUTPUT);    // sets the digital pin as output
    //Serial.begin(115200);        // initialize the uart to 115200 baud
}

void loop()
{
    sensorValue = analogRead(lightSensorPin);    // read the input pin
    if(sensorValue > THRESHOLD_VALUE){
        digitalWrite(ledPin, HIGH);        // sets the LED on
    }else{
        digitalWrite(ledPin, LOW);        // sets the LED off
    }
    delay(200);    // wait this many milliseconds
    //Serial.println(sensorValue);            // display on serial terminal
}

  1. Select Project from the main menu and choose Build Project.
  2. If there are any errors they will be displayed in the Problems tab.

Now follow the steps under Debugging your ARM Board Project.

Grove Project Import

Here's a fast, easy way to start a new project that uses Grove Modules:

  1. In KDS, click the File menu and select Import...
  2. Under General choose "Existing Projects into Workspace".  Click the Next > button.
  3. Click the Browse button next to "select root directory".  Find the directory where you installed the Axiom ARM Support Software and select the sub-directory: Source\Grove. 
  4. Click the OK button and you will see a list of Projects, one for ecah Axiom ARM board with Grove support.  Check the project that matches the name of your board.  So if you have the AXM-0702-CM-K60D board click on the box next to the CM-K60D project.
  5. Under Options, check "Copy projects into workspace".  Click the Finish button

You should now have a new project with the name of your board.  To rename the project:

  1. Right click the project name on the Project Explorer on the left then choose Rename...
  2. Type the name you want for your project and click OK
  3. Right click the project name again and choose Properties
  4. Under C/C++ Build / Settings select the Build Artifact tab
  5. Change the Artifact Name to the same name you gave your project then click OK.