Hello, i recently started programming arduino, but some times i keep getting an error, and i really don't know what is causing it. It is not even much lines of code.
void setup() {
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
}
void loop() {
for(int dot = 0; dot < NUM_LEDS; dot++) {
leds[dot][0] = 255;
FastLED.show();
// clear this led for the next time around the loop
leds[dot][0] = 0;
delay(30);
}
}
This is just supposed to be one of the most basic pieces of code, that is supposed to just have one red led following the led strip. This is the error i keep getting, i was not able to find a clear solution to this problem online. I have also gotten this error in other occasions and it seems to just happen sometimes.:
C:\Users\Thoma\Documents\Arduino\libraries\FastLED/controller.h: In member function 'clearLeds': C:\Users\Thoma\Documents\Arduino\libraries\FastLED/controller.h:76:82: internal compiler error: Segmentation fault
it has one, but I have read somewhere that indexing like this is a way of addressing the rgb values. [0] for red, [1] for green, and [2] for blue.
(Edit)
i just replaced leds[dot][0] = 255; with leds[dot] = CRGB( 255, 0, 0);
and it still gives the same error.
Data Members
CRGB has three one-byte data members, each representing one of the three red, green, and blue color channels of the color. There is more than one way to access the RGB data; each of these following examples does exactly the same thing:
// The three color channel values can be referred to as "red", "green", and "blue"...
leds[i].red = 50;
leds[i].green = 100;
leds[i].blue = 150;
// ...or, using the shorter synonyms "r", "g", and "b"...
leds[i].r = 50;
leds[i].g = 100;
leds[i].b = 150;
// ...or as members of a three-element array:
leds[i][0] = 50; // red
leds[i][1] = 100; // green
leds[i][2] = 150; // blue
Its in an obscure way because i want to modify the rgb values in a weird way, because i have my leds arranged in a panel of table tennis balls, so they're arranged in triangles. Also, i just started with arduino and this is just my way of starting, definitely not efficient yet. Efficiency will come from experience i hope. i'm using windows 10, IDE 1.8.7, on a uno.
Do you thing i might have the fastled library installed wrong? i just installed it prom the ide (using the search library function)
also, I'm using FastLED version 3.002.000
I am using version 3.2.0 (when i try to compile it just says it is using version 3.002.000 ). I also tried using fastled 3.1.6, wich didnt solve my problem.
I am using ide 1.8.7 . I will try downgrading it to 1.8.5 . Thanks for the tip .
The "segmentation fault" issue with the new avr-gcc 5.4.0 compiler version introduced in Arduino IDE 1.8.7/Arduino AVR Boards 1.6.22 has been reported in the Arduino bug tracker:
Unfortunately there has been no progress on that issue.
If you want to continue using Arduino IDE 1.8.7, you can simply roll back to Arduino AVR Boards 1.6.21:
Tools > Board > Boards Manager
Wait for downloads to finish
When you move the mouse pointer over "Arduino AVR Boards", you will see a "Select version" dropdown menu appear. Select "1.6.21".
Click "Install"
Wait for installation to finish.
Click "Close".
If you have File > Preferences > Check for updates on startup checked, the Arduino IDE may occasionally notify you that a new version of Arduino AVR Boards is available, you'll need to refrain from updating back to the new Arduino AVR Boards version, otherwise you'll be back to seeing the segmentation fault error again.
pert:
The "segmentation fault" issue with the new avr-gcc 5.4.0 compiler version introduced in Arduino IDE 1.8.7/Arduino AVR Boards 1.6.22 has been reported in the Arduino bug tracker:
Unfortunately there has been no progress on that issue.
If you want to continue using Arduino IDE 1.8.7, you can simply roll back to Arduino AVR Boards 1.6.21:
Tools > Board > Boards Manager
Wait for downloads to finish
When you move the mouse pointer over "Arduino AVR Boards", you will see a "Select version" dropdown menu appear. Select "1.6.21".
Click "Install"
Wait for installation to finish.
Click "Close".
If you have File > Preferences > Check for updates on startup checked, the Arduino IDE may occasionally notify you that a new version of Arduino AVR Boards is available, you'll need to refrain from updating back to the new Arduino AVR Boards version, otherwise you'll be back to seeing the segmentation fault error again.
This worked for me aswell. This segmentation issue is a funny one, sometimes simply making minor mods to the code seems to fix, however very "unscientific". Thanks