LilyPad Safety Scarf
Software Installation
Arduino IDE
The LilyPad USB Plus is programmable via the Arduino IDE. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE.
Installing Arduino IDE
LilyPad USB Plus and Board Add-On
If this is your first time working with the LilyPad ProtoSnap Plus, you will need to add the board through the boards manager to your program. Please visit the LilyPad ProtoSnap Plus hookup guide for detailed instructions on installing drivers and programming a LilyPad via the Arduino IDE.
Arduino Program
Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE.
We have provided the code for this project below. Copy and paste it into your Arduino IDE and then upload it to your board. Make sure you have the correct board selected in the boards manager as well as the port under the port drop down.
//Melissa Felderman for SparkFun Electronics 2017 //variable for sensor pin int sensorPin = A2; //variable for light value int lightValue; //variable for LEDPin int LEDPin = 11; void setup() { // Set sensorPin as an INPUT pinMode(sensorPin, INPUT); //set LEDPin as OUTPUT pinMode(LEDPin, OUTPUT); void loop() { // Get the current light level lightValue = analogRead(sensorPin); //if light level is low, turn LEDS on if(lightValue <= 15){ digitalWrite(LEDPin, HIGH); } //if light is high, turn LEDs off else { digitalWrite(LEDPin, LOW); } }