Hello,
I've written some code that reads a couple of inputs from push button and make a couple of neopixel flashes with the fastled library.
My code run fine on a regular nano. I've upload it to a nano every and it does literraly nothing. the every can run Blink or whatever example just fine. I'm at a bit of a loss here.
Here is my setup function:
void setup() {
currentMillis = millis();
prevMillis = currentMillis;
//Ding();
pinMode(LEDS_R, OUTPUT);
pinMode(LEDS_G, OUTPUT);
pinMode(BTN_LED_R, OUTPUT);
pinMode(BTN_LED_G, OUTPUT);
pinMode(BTN_R, INPUT);
pinMode(BTN_G, INPUT);
//pinMode(TRIG_1, OUTPUT);
pinMode(TRIG_2, OUTPUT);
Serial.begin(9600);
Serial.println("Initializing...");
EEPROM.get(ADDR_G, nbG);
EEPROM.get(ADDR_R, nbR);
Serial.print("Value stored ");
Serial.print(round(nbR));
Serial.print(": ");
Serial.println(round(nbG));
FastLED.addLeds<WS2812, LEDS_R, RGB>(leds_R, NUM_LEDS);
FastLED.addLeds<WS2812, LEDS_G, RGB>(leds_G, NUM_LEDS);
attachInterrupt(digitalPinToInterrupt(BTN_R), PressedR, FALLING);
digitalWrite(BTN_LED_R, HIGH);
attachInterrupt(digitalPinToInterrupt(BTN_G), PressedG, FALLING);
digitalWrite(BTN_LED_G, HIGH);
//digitalWrite(TRIG_1, HIGH);
digitalWrite(TRIG_2, LOW);
for (int i =0; i < NUM_LEDS; i++ )
{
leds_R[9-i] = CRGB::Red;
leds_G[i] = CRGB::Green;
}
FastLED.show();
delay(1000);
for (int i =0; i < NUM_LEDS; i++ )
{
leds_R[9-i] = CRGB::Black;
leds_G[i] = CRGB::Black;
}
FastLED.show();
}
Here is my loop function:
void loop() {
Idle();
}
void Idle() { //pulse both btn with PWN signal
float in, out;
for (in = 0; in < 6.283; in = in + 0.00314)
{
out = sin(in) * 127.5 + 127.5;
analogWrite(BTN_LED_R,out);
analogWrite(BTN_LED_G,out);
delay(3);
}
}
My buttons don't pulse and the serial monitor is completly quiet on the every and everything works fine a on a regular nano. I've tested on three separate every and four different nano.
What could cause this?