Led driver failed

error: stray '\342' in program

Let me take a look.

Ok, there’s the problem -

How does "Led driver failed" have to do with stray '\342' in program. Check your code and look where you have a "\x" in a print statement, ignore the x.

You copied something from the web. You can clean it out using a decent editor that supports regular expressions; for Windows, e.g. Notepad++, in Linux e.g. vi and no idea about Macs.

See Exit status 1 stray '\342' in program - #10 by UKHeliBob for the regular expression to use.

error: stray '\342' in program


//Calibrated values
  const float RC = 255;
  const float GC = 128;
  const float BC = 34;
  const float WC = 100;
  for (int i = 0; i < NUMPIXELS; i++) { // For each pixel...

    // pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
    // Here we're using a moderately bright green color:


    uint16_t rd = leds[i].r;
    uint16_t grn = leds[i].g;
    uint16_t blu = leds[i].b;

    uint8_t r = leds[i].r;
    uint8_t g = leds[i].g;
    uint8_t b = leds[i].b;
    uint8_t w = min( r, g);
    w = min( w, b);
    r = r - w;
    g = g - w;
    b = b - w;

    //g = g + (w / 2);
    //b = b + w;

//    //Normalized red, green, and blue
//    float rn = rd * WC / RC;
//    float gn = grn * WC / GC;
//    float bn = blu * WC / BC;
//    //Find maximum white value that won’t desaturate
//    float wn = min( rn, gn );
//    wn = min( wn, bn );
//    wn = min( wn, 255 ); //maximum white contribution reached.
//    //Remove red, green, and blue contributions supplied by the white LED
//    rn = rd - wn * RC / WC;
//    gn = grn - wn * GC / WC;
//    bn = blu - wn * BC / WC;
//    //Cap red, green, and blue values at 255.
//    r = min( rn, 255 );
//    g = min( gn, 255 );
//    b = min( bn, 255 );
//    w = wn;


    pixels.setPixelColor(i, pixels.Color(r, g, b, w));

    // pixels.show();   // Send the updated pixel colors to the hardware.

    //  delay(DELAYVAL); // Pause before next pass through loop
  }
  pixels.show();   // Send the updated pixel colors to the hardware.


Arduino: 1.8.19 (Windows 10), Board: "Arduino Leonardo"

"C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\idowu\AppData\Local\Temp\arduino_build_664768\preproc\ctags_target_for_gcc_minus_e.cpp"

Compiling sketch...

"C:\Users\idowu\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8036 "-DUSB_MANUFACTURER="Unknown"" "-DUSB_PRODUCT="Arduino Leonardo"" "-IC:\Users\idowu\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.4\cores\arduino" "-IC:\Users\idowu\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.4\variants\leonardo" "-IC:\Users\idowu\Documents\Arduino\libraries\FastLED\src" "C:\Users\idowu\AppData\Local\Temp\arduino_build_664768\sketch\TwinkleFox1_Error.ino.cpp" -o "C:\Users\idowu\AppData\Local\Temp\arduino_build_664768\sketch\TwinkleFox1_Error.ino.cpp.o"

TwinkleFox1_Error:133:3: error: stray '\342' in program

float bn = blu * WC / BC;

^

TwinkleFox1_Error:133:4: error: stray '\202' in program

bn = blu - wn * BC / WC;

^

TwinkleFox1_Error:133:5: error: stray '\254' in program

b = min( bn, 255 );

 ^

Using library FastLED at version 3.5.0 in folder: C:\Users\idowu\Documents\Arduino\libraries\FastLED

exit status 1

stray '\342' in program

You have illegal characters in your source code ... it happens often, especially when copying and pasting from the web.

Try to check the quotes or single quotes or if there is any strange character.

I answered this question I believe yesterday I think this is a double post as my comment is not here and the question is the same but different punctuation only in the title. I am not sure of the code as I did not load it because previously and not it is not posted properly.

I have merged your cross-posts @id543813.

Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting can result in a suspension from the forum.

In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.