Hallo zusammen
Hab seit 2 Tagen ein Problem mit dem Uno.
Habe diesen Sketch unten erfolgreich auf dem Uno und Nano hochgeladen, die LED´s aber gingen immer noch nicht. Also es passierte nichts wenn ich mit der Software rumprobiert habe.
Danach wollte ich auf dem Uno ein anderes uploaden. Jetzt kann ich garnichts uploaden.
Ist der Uno kaputt?
#include "FastLED.h"
#define NUM_LEDS (2*10+2*5)
#define LED_DATA_PIN 6
#define NUM_BYTES (NUM_LEDS*3) // 3 colors
#define BRIGHTNESS 255
#define UPDATES_PER_SECOND 60
#define TIMEOUT 3000
#define MODE_ANIMATION 0
#define MODE_AMBILIGHT 1
#define MODE_BLACK 2
uint8_t mode = MODE_ANIMATION;
byte MESSAGE_PREAMBLE[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
uint8_t PREAMBLE_LENGTH = 10;
uint8_t current_preamble_position = 0;
unsigned long last_serial_available = -1L;
int led_counter = 0;
int byte_counter = 0;
CRGB leds[NUM_LEDS];
byte buffer[NUM_BYTES];
// Filler animation attributes
CRGBPalette16 currentPalette = RainbowColors_p;
TBlendType currentBlending = LINEARBLEND;
uint8_t startIndex = 0;
void setup()
{
Serial.begin(1000000); // 115200
FastLED.clear(true);
FastLED.addLeds<WS2812B, LED_DATA_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(BRIGHTNESS);
}
void loop()
{
switch (mode) {
case MODE_ANIMATION:
fillLEDsFromPaletteColors();
break;
case MODE_AMBILIGHT:
processIncomingData();
break;
case MODE_BLACK:
showBlack();
break;
}
}
void processIncomingData()
{
if (waitForPreamble(TIMEOUT))
{
Serial.readBytes(buffer, NUM_BYTES);
while (byte_counter < NUM_BYTES)
{
byte blue = buffer[byte_counter++];
byte green = buffer[byte_counter++];
byte red = buffer[byte_counter++];
leds[led_counter++] = CRGB(red, green, blue);
}
FastLED.show();
// flush the serial buffer to avoid flickering
while(Serial.available()) { Serial.read(); }
byte_counter = 0;
led_counter = 0;
}
else
{
//if we get here, there must have been data before(so the user already knows, it works!)
//simply go to black!
mode = MODE_BLACK;
}
}
bool waitForPreamble(int timeout)
{
last_serial_available = millis();
current_preamble_position = 0;
while (current_preamble_position < PREAMBLE_LENGTH)
{
if (Serial.available() > 0)
{
last_serial_available = millis();
if (Serial.read() == MESSAGE_PREAMBLE[current_preamble_position])
{
current_preamble_position++;
}
else
{
current_preamble_position = 0;
}
}
if (millis() - last_serial_available > timeout)
{
return false;
}
}
return true;
}
void fillLEDsFromPaletteColors()
{
startIndex++;
uint8_t colorIndex = startIndex;
for( int i = 0; i < NUM_LEDS; i++) {
leds[i] = ColorFromPalette(currentPalette, colorIndex, BRIGHTNESS, currentBlending);
colorIndex += 3;
}
FastLED.delay(1000 / UPDATES_PER_SECOND);
if (Serial.available() > 0)
{
mode = MODE_AMBILIGHT;
}
}
void showBlack()
{
for( int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(0,0,0);
}
FastLED.delay(1000 / UPDATES_PER_SECOND);
if (Serial.available() > 0)
{
mode = MODE_AMBILIGHT;
}
}
Das ist die Fehlermeldung die ich bekomme.
Arduino: 1.8.2 (Windows 10), Board: "Arduino/Genuino Uno"
In file included from D:\Eigene Dateien\Downloads\Bambilight-master\Bambilight-master\Arduino\bambilight\bambilight.ino:1:0:
D:\Eigene Dateien\Dokumente\Arduino\libraries\FastLED/FastLED.h:17:21: note: #pragma message: FastLED version 3.001.003
# pragma message "FastLED version 3.001.003"
^
Der Sketch verwendet 5698 Bytes (17%) des Programmspeicherplatzes. Das Maximum sind 32256 Bytes.
Globale Variablen verwenden 517 Bytes (25%) des dynamischen Speichers, 1531 Bytes für lokale Variablen verbleiben. Das Maximum sind 2048 Bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x0a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x0a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x0a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x0a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x0a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x0a
Problem beim Hochladen auf das Board. Hilfestellung dazu unter http://www.arduino.cc/en/Guide/Troubleshooting#upload.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x0a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x0a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x0a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x0a
Dieser Bericht wäre detaillierter, wenn die Option
"Ausführliche Ausgabe während der Kompilierung"
in Datei -> Voreinstellungen aktiviert wäre.