Skip to content

Commit

Permalink
Added example code tu turn leds off, for resetting the state
Browse files Browse the repository at this point in the history
  • Loading branch information
rac2030 committed Jun 16, 2018
1 parent 548e71e commit f04f9e7
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
6 changes: 6 additions & 0 deletions firmware/examples/LED-OFF/.vscode/arduino.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"board": "espressif:esp32:nina_w10",
"configuration": "UploadSpeed=115200",
"port": "/dev/ttyUSB0",
"sketch": "LED-OFF.ino"
}
21 changes: 21 additions & 0 deletions firmware/examples/LED-OFF/.vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"/home/rac/Arduino/hardware/espressif/esp32/cores/esp32"
],
"browse": {
"limitSymbolsToIncludedHeaders": false,
"path": [
"/home/rac/Arduino/hardware/espressif/esp32/cores/esp32"
]
},
"intelliSenseMode": "clang-x64",
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17"
}
],
"version": 4
}
28 changes: 28 additions & 0 deletions firmware/examples/LED-OFF/LED-OFF.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* LED siren example for MakeZurich badge 2018
*/
#define FASTLED_ALLOW_INTERRUPTS 0
#include "FastLED.h"

#define NUM_LEDS 2
#define DATA_PIN 27 // GPIO18

// Define the array of leds
CRGB leds[NUM_LEDS];

void setup() {
Serial.begin(115200);
Serial.println("\n\nTurn LEDs off");
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
}

void loop() {
ledOff();
delay(5000);
}

void ledOff() {
leds[0] = CRGB::Black;
leds[1] = CRGB::Black;
FastLED.show();
}
3 changes: 3 additions & 0 deletions firmware/examples/LED-OFF/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# LED OFF

Turns off both LEDs on the MakeZurich badge 2018 to reset in case a new programm will be flashed that does not set the LED state hence they keep the last state.

0 comments on commit f04f9e7

Please sign in to comment.