Simple light sensor connected to a Luminet2 board with conductive thread.
The links to the board are
  • + connected to power (VCC)
  • - connected to ground (GND)
  • S connected to an input pin (A0)

The code uploaded to Luminet2 lights the LED green when it becomes darker.


The code is written in the Arduino IDE and is uploaded to the Luminet2 board through a serial connection.

{CODE(colors="c")}
int greenLed=9; //the pin number for the Green LED

void setup() {
//inform the micro-controller that a sensor is connected to pin A0
pinMode(A0, INPUT);
//inform the micro-controller that an actuator (in our case the green LED) is connected to pin 9
pinMode(greenLed, OUTPUT);
}

void loop() {
if(analogRead(0)<100){
digitalWrite(greenLed, HIGH);//turns the green LED ON
}else{
digitalWrite(greenLed, LOW); //turns the green LED OFF
}
}{CODE}
See the Luminet2 with Arduino tutorial for how to reprogram Luminet2 with the Arduino IDE.

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.