|
@@ -4,6 +4,8 @@
|
|
|
#include <SPI.h>
|
|
|
#include <Tsunami.h>
|
|
|
#include <FadeLed.h>
|
|
|
+//#include <OctoWS2811.h>
|
|
|
+#include "FastLED.h"
|
|
|
|
|
|
const int BUTTON_PIN[10] = {30, 31, 32, 33, 34, 35, 36, 37, 38, 39} ;
|
|
|
int currentButton ;
|
|
@@ -34,24 +36,26 @@ EvtListener *pDelay ;
|
|
|
//delay
|
|
|
int delay_start ;
|
|
|
unsigned long delay_length ;
|
|
|
-bool inibSDreading ;
|
|
|
+bool inibSDreading = true;
|
|
|
bool delay_flag ; //prevent first event to fire
|
|
|
|
|
|
//Dimmer
|
|
|
#define DIMMER_PIN 9
|
|
|
FadeLed dimmer(DIMMER_PIN);
|
|
|
-//int dimmer_value;
|
|
|
-//int dimmer_target;
|
|
|
-//int dimmer_fade;
|
|
|
-//int dimmer_delta ; //to add each "loop"
|
|
|
-////EvtListener *pDimmer; // identified listener to be able to kill after fade
|
|
|
-//
|
|
|
-//bool state = LOW;
|
|
|
-//int test;
|
|
|
-//int test2;
|
|
|
-//
|
|
|
-//
|
|
|
-//EvtListener *plist2;
|
|
|
+
|
|
|
+//// OctoWS2811 settings
|
|
|
+//const int ledsPerStrip = 10; // change for your setup
|
|
|
+//const byte numStrips= 2; // change for your setup
|
|
|
+//DMAMEM int displayMemory[ledsPerStrip*numStrips];
|
|
|
+//int drawingMemory[ledsPerStrip*numStrips];
|
|
|
+//const int config = WS2811_GRB | WS2811_800kHz;
|
|
|
+//OctoWS2811 leds(10, displayMemory, drawingMemory, config);
|
|
|
+
|
|
|
+// FastLED
|
|
|
+#define NUM_LEDS_LUSTRE 240
|
|
|
+#define NUM_LEDS_TABLE 50
|
|
|
+CRGB lustreLeds[NUM_LEDS_LUSTRE];
|
|
|
+CRGB tableLeds[NUM_LEDS_TABLE];
|
|
|
|
|
|
//Functions prototypes
|
|
|
void EvtResetButtonContext ();
|
|
@@ -98,6 +102,30 @@ void setup() {
|
|
|
Serial.println("fading down");
|
|
|
dimmer.off();
|
|
|
while (!dimmer.done()) {FadeLed::update();}
|
|
|
+
|
|
|
+ // OctoWS2811
|
|
|
+// leds.begin();
|
|
|
+// delay(500);
|
|
|
+// for (int i ; i< ledsPerStrip * numStrips ; i++) {
|
|
|
+// leds.setPixel(i, 255, 255, 255);
|
|
|
+// leds.show();
|
|
|
+// delay(50);
|
|
|
+// leds.setPixel(i, 0, 0, 0);
|
|
|
+// leds.show();
|
|
|
+// }
|
|
|
+
|
|
|
+//FastLED
|
|
|
+ FastLED.addLeds<NEOPIXEL, 2>(lustreLeds, NUM_LEDS_LUSTRE);
|
|
|
+ FastLED.addLeds<NEOPIXEL, 14>(tableLeds, NUM_LEDS_TABLE);
|
|
|
+ for (int i ; i<NUM_LEDS_LUSTRE ; i++) {
|
|
|
+ lustreLeds[i] = CRGB::White ;
|
|
|
+ tableLeds[i] = CRGB::White ;
|
|
|
+ FastLED.show();
|
|
|
+ delay(10);
|
|
|
+ lustreLeds[i] = CRGB::Black ;
|
|
|
+ tableLeds[i] = CRGB::Black ;
|
|
|
+ FastLED.show();
|
|
|
+ }
|
|
|
|
|
|
// TSUNAMI
|
|
|
// We should wait for the Tsunami to finish reset
|
|
@@ -133,7 +161,7 @@ void setup() {
|
|
|
delay(500);
|
|
|
tsunami.trackPlayPoly(7, 3, true);
|
|
|
delay(500);
|
|
|
- tsunami.trackPlayPoly(8, 4, true);
|
|
|
+ tsunami.trackPlayPoly(8, 3, true);
|
|
|
|
|
|
|
|
|
|
|
@@ -298,7 +326,7 @@ void tlcWrite(){
|
|
|
|
|
|
void buttonFocus(int index) {
|
|
|
currentButton = index ;
|
|
|
- Serial.println(currentButton);
|
|
|
+ //Serial.println(currentButton);
|
|
|
//turn off all leds but currentButton one
|
|
|
for (int i ; i < sizeof(ledState)/sizeof(uint32_t) ; i++) {
|
|
|
|
|
@@ -315,12 +343,14 @@ void buttonFocus(int index) {
|
|
|
String file = "button";
|
|
|
file+=index ;
|
|
|
file+=".txt";
|
|
|
- btnFile = SD.open(file.c_str()) ;
|
|
|
+ //btnFile = SD.open(file.c_str()) ;
|
|
|
+ btnFile = SD.open("button0.txt");
|
|
|
Serial.println("opening " + file);
|
|
|
- if (!file) {
|
|
|
- Serial.print("The text file cannot be opened");
|
|
|
+ if (!btnFile) {
|
|
|
+ Serial.println("The text file cannot be opened");
|
|
|
// return false;
|
|
|
}
|
|
|
+// while(
|
|
|
inibSDreading = false ;
|
|
|
//mgr.addListener(new EvtTimeListener(10, true, (EvtAction)readSDFile));
|
|
|
//mgr.addListener(new EvtTimeListener(50, true, (EvtAction)fadeDimmer));
|