Components and supplies
9V to Barrel Jack Connector
Arduino UNO
Male-Header 5 Position- 1 Row- Long (0.1")
Male/Female Jumper Wires
9V battery (generic)
ws2812 8x8 RGB LED matrix
Tools and machines
Solder Wire, Lead Free
Soldering iron (generic)
Project description
Code
LED_Arduino
c_cpp
This sketch forms the foundation of the project. On saving it should be set to Read-Only and further usage to be as 'Save As' for archiving to prevent overwriting and allow easy reedit.
1//VARIABLES AND DEFINES HERE - NEEDED BY THE WS2812 DRIVER CODE 2#define WS2812_pin 8 // only digital pin 8 works right now 3#define numberOfLEDs 64// total number of RGB LEDs [256] 4byte RGB[192];//take your number of LEDs and multiply by 3 [768] 5 6// FUNCTIONS HERE 7void RGB_update(int LED, byte RED, byte GREEN, byte BLUE);//function to drive LEDs 8 9void mapLEDXY(int x, int y, byte RED, byte GREEN, byte BLUE) { 10 int RGBlocation = 0; 11 12 //if (y % 2 == 0) { //even column [Uncomment] 13 14 RGBlocation = x + y * 8; //[16] 15 // } else { //odd column [Uncomment] 16 17 //RGBlocation = 7 - x + y * 8; //[15] and [16] 18 // } [Uncomment] 19 20 RGB[RGBlocation * 3] = BLUE; 21 RGB[RGBlocation * 3 + 1] = RED; 22 RGB[RGBlocation * 3 + 2] = GREEN; 23} 24void clearLEDs() { 25 memset(RGB, 0, sizeof(RGB)); 26} 27 28 29void setup() { 30 pinMode(WS2812_pin, OUTPUT); 31 clearLEDs(); 32 RGB_update(-1, 0, 0, 0); 33 34}//setup0 35 36 37void loop() { 38//Paste mapLEDXY line(s) directly above the RGB_update below. 39 40RGB_update(-1, 0, 0, 0); 41 delay(1000); 42 clearLEDs(); 43 RGB_update(-1, 0, 0, 0); 44 delay(1000); 45 46}//loop 47 48 49//WS2812 Driver Function 50void RGB_update(int LED, byte RED, byte GREEN, byte BLUE) { 51 // LED is the LED number starting with 0 52 // RED, GREEN, BLUE is the brightness 0..255 setpoint for that LED 53 byte ExistingPort, WS2812pinHIGH;//local variables here to speed up pinWrites 54 55 if (LED >= 0) { //map the REG GREEN BLUE Values into the RGB[] array 56 RGB[LED * 3] = GREEN; 57 RGB[LED * 3 + 1] = RED; 58 RGB[LED * 3 + 2] = BLUE; 59 } 60 61 noInterrupts();//kill the interrupts while we send the bit stream out... 62 ExistingPort = PORTB; // save the status of the entire PORT B - let's us write to the entire port without messing up the other pins on that port 63 WS2812pinHIGH = PORTB | 1; //this gives us a byte we can use to set the whole PORTB with the WS2812 pin HIGH 64 int bitStream = numberOfLEDs * 3;//total bytes in the LED string 65 66 //This for loop runs through all of the bits (8 at a time) to set the WS2812 pin ON/OFF times 67 for (int i = bitStream - 1; i >= 0; i--) { 68 69 PORTB = WS2812pinHIGH;//bit 7 first, set the pin HIGH - it always goes high regardless of a 0/1 70 71 //here's the tricky part, check if the bit in the byte is high/low then right that status to the pin 72 // (RGB[i] & B10000000) will strip away the other bits in RGB[i], so here we'll be left with B10000000 or B00000000 73 // then it's easy to check if the bit is high or low by AND'ing that with the bit mask ""&& B10000000)"" this gives 1 or 0 74 // if it's a 1, we'll OR that with the Existing port, thus keeping the pin HIGH, if 0 the pin is written LOW 75 PORTB = ((RGB[i] & B10000000) && B10000000) | ExistingPort; 76 __asm__("nop\ 77\ ""nop\ 78\ ""nop\ 79\ ""nop\ 80\ ""nop\ 81\ ");//these are NOPS - these let us delay clock cycles for more precise timing 82 PORTB = ExistingPort;//okay, here we know we have to be LOW regardless of the 0/1 bit state 83 __asm__("nop\ 84\ ""nop\ 85\ ""nop\ 86\ ""nop\ 87\ ""nop\ 88\ ""nop\ 89\ ""nop\ 90\ ");//minimum LOW time for pin regardless of 0/1 bit state 91 92 // then do it again for the next bit and so on... see the last bit though for a slight change 93 94 PORTB = WS2812pinHIGH;//bit 6 95 PORTB = ((RGB[i] & B01000000) && B01000000) | ExistingPort; 96 __asm__("nop\ 97\ ""nop\ 98\ ""nop\ 99\ ""nop\ 100\ ""nop\ 101\ "); 102 PORTB = ExistingPort; 103 __asm__("nop\ 104\ ""nop\ 105\ ""nop\ 106\ ""nop\ 107\ ""nop\ 108\ ""nop\ 109\ ""nop\ 110\ "); 111 112 PORTB = WS2812pinHIGH;//bit 5 113 PORTB = ((RGB[i] & B00100000) && B00100000) | ExistingPort; 114 __asm__("nop\ 115\ ""nop\ 116\ ""nop\ 117\ ""nop\ 118\ ""nop\ 119\ "); 120 PORTB = ExistingPort; 121 __asm__("nop\ 122\ ""nop\ 123\ ""nop\ 124\ ""nop\ 125\ ""nop\ 126\ ""nop\ 127\ ""nop\ 128\ "); 129 130 PORTB = WS2812pinHIGH;//bit 4 131 PORTB = ((RGB[i] & B00010000) && B00010000) | ExistingPort; 132 __asm__("nop\ 133\ ""nop\ 134\ ""nop\ 135\ ""nop\ 136\ ""nop\ 137\ "); 138 PORTB = ExistingPort; 139 __asm__("nop\ 140\ ""nop\ 141\ ""nop\ 142\ ""nop\ 143\ ""nop\ 144\ ""nop\ 145\ ""nop\ 146\ "); 147 148 PORTB = WS2812pinHIGH;//bit 3 149 PORTB = ((RGB[i] & B00001000) && B00001000) | ExistingPort; 150 __asm__("nop\ 151\ ""nop\ 152\ ""nop\ 153\ ""nop\ 154\ ""nop\ 155\ "); 156 PORTB = ExistingPort; 157 __asm__("nop\ 158\ ""nop\ 159\ ""nop\ 160\ ""nop\ 161\ ""nop\ 162\ ""nop\ 163\ ""nop\ 164\ "); 165 166 PORTB = WS2812pinHIGH;//bit 2 167 PORTB = ((RGB[i] & B00000100) && B00000100) | ExistingPort; 168 __asm__("nop\ 169\ ""nop\ 170\ ""nop\ 171\ ""nop\ 172\ ""nop\ 173\ "); 174 PORTB = ExistingPort; 175 __asm__("nop\ 176\ ""nop\ 177\ ""nop\ 178\ ""nop\ 179\ ""nop\ 180\ ""nop\ 181\ ""nop\ 182\ "); 183 184 PORTB = WS2812pinHIGH;//bit 1 185 PORTB = ((RGB[i] & B00000010) && B00000010) | ExistingPort; 186 __asm__("nop\ 187\ ""nop\ 188\ ""nop\ 189\ ""nop\ 190\ ""nop\ 191\ "); 192 PORTB = ExistingPort; 193 __asm__("nop\ 194\ ""nop\ 195\ ""nop\ 196\ ""nop\ 197\ ""nop\ 198\ ""nop\ 199\ ""nop\ 200\ "); 201 202 PORTB = WS2812pinHIGH;//bit 0 203 __asm__("nop\ 204\ ");//on this last bit, the check is much faster, so had to add a NOP here 205 PORTB = ((RGB[i] & B00000001) && B00000001) | ExistingPort; 206 __asm__("nop\ 207\ ""nop\ 208\ ""nop\ 209\ ""nop\ 210\ ""nop\ 211\ "); 212 PORTB = ExistingPort;//note there are no NOPs after writing the pin LOW, this is because the FOR Loop uses clock cycles that we can use instead of the NOPS 213 }//for loop 214 215 216 interrupts();//enable the interrupts 217 218 // all done! 219}//void RGB_update 220
Sketches.zip
These are some of or more sketches used during development. They are available as 'support'.
LED_Arduino
c_cpp
This sketch forms the foundation of the project. On saving it should be set to Read-Only and further usage to be as 'Save As' for archiving to prevent overwriting and allow easy reedit.
1//VARIABLES AND DEFINES HERE - NEEDED BY THE WS2812 DRIVER CODE 2#define WS2812_pin 8 // only digital pin 8 works right now 3#define numberOfLEDs 64// total number of RGB LEDs [256] 4byte RGB[192];//take your number of LEDs and multiply by 3 [768] 5 6// FUNCTIONS HERE 7void RGB_update(int LED, byte RED, byte GREEN, byte BLUE);//function to drive LEDs 8 9void mapLEDXY(int x, int y, byte RED, byte GREEN, byte BLUE) { 10 int RGBlocation = 0; 11 12 //if (y % 2 == 0) { //even column [Uncomment] 13 14 RGBlocation = x + y * 8; //[16] 15 // } else { //odd column [Uncomment] 16 17 //RGBlocation = 7 - x + y * 8; //[15] and [16] 18 // } [Uncomment] 19 20 RGB[RGBlocation * 3] = BLUE; 21 RGB[RGBlocation * 3 + 1] = RED; 22 RGB[RGBlocation * 3 + 2] = GREEN; 23} 24void clearLEDs() { 25 memset(RGB, 0, sizeof(RGB)); 26} 27 28 29void setup() { 30 pinMode(WS2812_pin, OUTPUT); 31 clearLEDs(); 32 RGB_update(-1, 0, 0, 0); 33 34}//setup0 35 36 37void loop() { 38//Paste mapLEDXY line(s) directly above the RGB_update below. 39 40RGB_update(-1, 0, 0, 0); 41 delay(1000); 42 clearLEDs(); 43 RGB_update(-1, 0, 0, 0); 44 delay(1000); 45 46}//loop 47 48 49//WS2812 Driver Function 50void RGB_update(int LED, byte RED, byte GREEN, byte BLUE) { 51 // LED is the LED number starting with 0 52 // RED, GREEN, BLUE is the brightness 0..255 setpoint for that LED 53 byte ExistingPort, WS2812pinHIGH;//local variables here to speed up pinWrites 54 55 if (LED >= 0) { //map the REG GREEN BLUE Values into the RGB[] array 56 RGB[LED * 3] = GREEN; 57 RGB[LED * 3 + 1] = RED; 58 RGB[LED * 3 + 2] = BLUE; 59 } 60 61 noInterrupts();//kill the interrupts while we send the bit stream out... 62 ExistingPort = PORTB; // save the status of the entire PORT B - let's us write to the entire port without messing up the other pins on that port 63 WS2812pinHIGH = PORTB | 1; //this gives us a byte we can use to set the whole PORTB with the WS2812 pin HIGH 64 int bitStream = numberOfLEDs * 3;//total bytes in the LED string 65 66 //This for loop runs through all of the bits (8 at a time) to set the WS2812 pin ON/OFF times 67 for (int i = bitStream - 1; i >= 0; i--) { 68 69 PORTB = WS2812pinHIGH;//bit 7 first, set the pin HIGH - it always goes high regardless of a 0/1 70 71 //here's the tricky part, check if the bit in the byte is high/low then right that status to the pin 72 // (RGB[i] & B10000000) will strip away the other bits in RGB[i], so here we'll be left with B10000000 or B00000000 73 // then it's easy to check if the bit is high or low by AND'ing that with the bit mask ""&& B10000000)"" this gives 1 or 0 74 // if it's a 1, we'll OR that with the Existing port, thus keeping the pin HIGH, if 0 the pin is written LOW 75 PORTB = ((RGB[i] & B10000000) && B10000000) | ExistingPort; 76 __asm__("nop\ 77\ ""nop\ 78\ ""nop\ 79\ ""nop\ 80\ ""nop\ 81\ ");//these are NOPS - these let us delay clock cycles for more precise timing 82 PORTB = ExistingPort;//okay, here we know we have to be LOW regardless of the 0/1 bit state 83 __asm__("nop\ 84\ ""nop\ 85\ ""nop\ 86\ ""nop\ 87\ ""nop\ 88\ ""nop\ 89\ ""nop\ 90\ ");//minimum LOW time for pin regardless of 0/1 bit state 91 92 // then do it again for the next bit and so on... see the last bit though for a slight change 93 94 PORTB = WS2812pinHIGH;//bit 6 95 PORTB = ((RGB[i] & B01000000) && B01000000) | ExistingPort; 96 __asm__("nop\ 97\ ""nop\ 98\ ""nop\ 99\ ""nop\ 100\ ""nop\ 101\ "); 102 PORTB = ExistingPort; 103 __asm__("nop\ 104\ ""nop\ 105\ ""nop\ 106\ ""nop\ 107\ ""nop\ 108\ ""nop\ 109\ ""nop\ 110\ "); 111 112 PORTB = WS2812pinHIGH;//bit 5 113 PORTB = ((RGB[i] & B00100000) && B00100000) | ExistingPort; 114 __asm__("nop\ 115\ ""nop\ 116\ ""nop\ 117\ ""nop\ 118\ ""nop\ 119\ "); 120 PORTB = ExistingPort; 121 __asm__("nop\ 122\ ""nop\ 123\ ""nop\ 124\ ""nop\ 125\ ""nop\ 126\ ""nop\ 127\ ""nop\ 128\ "); 129 130 PORTB = WS2812pinHIGH;//bit 4 131 PORTB = ((RGB[i] & B00010000) && B00010000) | ExistingPort; 132 __asm__("nop\ 133\ ""nop\ 134\ ""nop\ 135\ ""nop\ 136\ ""nop\ 137\ "); 138 PORTB = ExistingPort; 139 __asm__("nop\ 140\ ""nop\ 141\ ""nop\ 142\ ""nop\ 143\ ""nop\ 144\ ""nop\ 145\ ""nop\ 146\ "); 147 148 PORTB = WS2812pinHIGH;//bit 3 149 PORTB = ((RGB[i] & B00001000) && B00001000) | ExistingPort; 150 __asm__("nop\ 151\ ""nop\ 152\ ""nop\ 153\ ""nop\ 154\ ""nop\ 155\ "); 156 PORTB = ExistingPort; 157 __asm__("nop\ 158\ ""nop\ 159\ ""nop\ 160\ ""nop\ 161\ ""nop\ 162\ ""nop\ 163\ ""nop\ 164\ "); 165 166 PORTB = WS2812pinHIGH;//bit 2 167 PORTB = ((RGB[i] & B00000100) && B00000100) | ExistingPort; 168 __asm__("nop\ 169\ ""nop\ 170\ ""nop\ 171\ ""nop\ 172\ ""nop\ 173\ "); 174 PORTB = ExistingPort; 175 __asm__("nop\ 176\ ""nop\ 177\ ""nop\ 178\ ""nop\ 179\ ""nop\ 180\ ""nop\ 181\ ""nop\ 182\ "); 183 184 PORTB = WS2812pinHIGH;//bit 1 185 PORTB = ((RGB[i] & B00000010) && B00000010) | ExistingPort; 186 __asm__("nop\ 187\ ""nop\ 188\ ""nop\ 189\ ""nop\ 190\ ""nop\ 191\ "); 192 PORTB = ExistingPort; 193 __asm__("nop\ 194\ ""nop\ 195\ ""nop\ 196\ ""nop\ 197\ ""nop\ 198\ ""nop\ 199\ ""nop\ 200\ "); 201 202 PORTB = WS2812pinHIGH;//bit 0 203 __asm__("nop\ 204\ ");//on this last bit, the check is much faster, so had to add a NOP here 205 PORTB = ((RGB[i] & B00000001) && B00000001) | ExistingPort; 206 __asm__("nop\ 207\ ""nop\ 208\ ""nop\ 209\ ""nop\ 210\ ""nop\ 211\ "); 212 PORTB = ExistingPort;//note there are no NOPs after writing the pin LOW, this is because the FOR Loop uses clock cycles that we can use instead of the NOPS 213 }//for loop 214 215 216 interrupts();//enable the interrupts 217 218 // all done! 219}//void RGB_update 220
Sketches.zip
These are some of or more sketches used during development. They are available as 'support'.
Led_Utility.xlsm
This application generates the various text for copy/paste into the sketch.
Comments
Only logged in users can leave comments
Murrayman
0 Followers
•1 Projects
3
1
Excel for WS2812 RGB LED Array Animations | Arduino Project Hub
billz1
8 months ago
When testing any of your examples, I get the following errors in the current Arduino IDE (see below). What changes to your program example do you suggest to get a working program? I can't see the 'garbage at end of line' that the IDE is referring to. Arduino: 1.8.13 (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)" C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\bill\AppData\Local\Arduino15\packages -hardware C:\Users\bill\Documents\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\bill\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\bill\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -ide-version=10813 -build-path C:\Users\bill\AppData\Local\Temp\arduino_build_876953 -warnings=none -build-cache C:\Users\bill\AppData\Local\Temp\arduino_cache_981259 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Users\bill\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\bill\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avrdude.path=C:\Users\bill\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\bill\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.arduinoOTA.path=C:\Users\bill\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\bill\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -verbose C:\Users\bill\AppData\Local\Temp\arduino_modified_sketch_319046\sketch_mar25a.ino C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\bill\AppData\Local\Arduino15\packages -hardware C:\Users\bill\Documents\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\bill\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\bill\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -ide-version=10813 -build-path C:\Users\bill\AppData\Local\Temp\arduino_build_876953 -warnings=none -build-cache C:\Users\bill\AppData\Local\Temp\arduino_cache_981259 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Users\bill\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\bill\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avrdude.path=C:\Users\bill\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\bill\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.arduinoOTA.path=C:\Users\bill\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\bill\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -verbose C:\Users\bill\AppData\Local\Temp\arduino_modified_sketch_319046\sketch_mar25a.ino Using board 'mega' from platform in folder: C:\Users\bill\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6 Using core 'arduino' from platform in folder: C:\Users\bill\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6 Warning: Board Breadboard:breadboard:atmega328bb doesn't define a 'build.board' preference. Auto-set to: BREADBOARD_ATMEGA328BB Detecting libraries used... "C:\\Users\\bill\\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 -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\bill\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\bill\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "C:\\Users\\bill\\AppData\\Local\\Temp\\arduino_build_876953\\sketch\\sketch_mar25a.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE Generating function prototypes... "C:\\Users\\bill\\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 -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\bill\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\bill\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "C:\\Users\\bill\\AppData\\Local\\Temp\\arduino_build_876953\\sketch\\sketch_mar25a.ino.cpp" -o "C:\\Users\\bill\\AppData\\Local\\Temp\\arduino_build_876953\\preproc\\ctags_target_for_gcc_minus_e.cpp" -DARDUINO_LIB_DISCOVERY_PHASE "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\\bill\\AppData\\Local\\Temp\\arduino_build_876953\\preproc\\ctags_target_for_gcc_minus_e.cpp" Compiling sketch... "C:\\Users\\bill\\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=atmega2560 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\bill\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\bill\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "C:\\Users\\bill\\AppData\\Local\\Temp\\arduino_build_876953\\sketch\\sketch_mar25a.ino.cpp" -o "C:\\Users\\bill\\AppData\\Local\\Temp\\arduino_build_876953\\sketch\\sketch_mar25a.ino.cpp.o" Compiling libraries... Compiling core... Using precompiled core: C:\Users\bill\AppData\Local\Temp\arduino_cache_981259\core\core_arduino_avr_mega_cpu_atmega2560_d9b30e61b49076c99692887f520bb462.a Linking everything together... "C:\\Users\\bill\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega2560 -o "C:\\Users\\bill\\AppData\\Local\\Temp\\arduino_build_876953/sketch_mar25a.ino.elf" "C:\\Users\\bill\\AppData\\Local\\Temp\\arduino_build_876953\\sketch\\sketch_mar25a.ino.cpp.o" "C:\\Users\\bill\\AppData\\Local\\Temp\\arduino_build_876953/..\\arduino_cache_981259\\core\\core_arduino_avr_mega_cpu_atmega2560_d9b30e61b49076c99692887f520bb462.a" "-LC:\\Users\\bill\\AppData\\Local\\Temp\\arduino_build_876953" -lm C:\Users\bill\AppData\Local\Temp\ccSH6mAa.s: Assembler messages: C:\Users\bill\AppData\Local\Temp\ccSH6mAa.s:53: Error: garbage at end of line C:\Users\bill\AppData\Local\Temp\ccSH6mAa.s:61: Error: garbage at end of line C:\Users\bill\AppData\Local\Temp\ccSH6mAa.s:76: Error: garbage at end of line C:\Users\bill\AppData\Local\Temp\ccSH6mAa.s:84: Error: garbage at end of line C:\Users\bill\AppData\Local\Temp\ccSH6mAa.s:99: Error: garbage at end of line C:\Users\bill\AppData\Local\Temp\ccSH6mAa.s:107: Error: garbage at end of line C:\Users\bill\AppData\Local\Temp\ccSH6mAa.s:121: Error: garbage at end of line C:\Users\bill\AppData\Local\Temp\ccSH6mAa.s:129: Error: garbage at end of line C:\Users\bill\AppData\Local\Temp\ccSH6mAa.s:144: Error: garbage at end of line C:\Users\bill\AppData\Local\Temp\ccSH6mAa.s:152: Error: garbage at end of line C:\Users\bill\AppData\Local\Temp\ccSH6mAa.s:167: Error: garbage at end of line C:\Users\bill\AppData\Local\Temp\ccSH6mAa.s:175: Error: garbage at end of line C:\Users\bill\AppData\Local\Temp\ccSH6mAa.s:189: Error: garbage at end of line C:\Users\bill\AppData\Local\Temp\ccSH6mAa.s:197: Error: garbage at end of line C:\Users\bill\AppData\Local\Temp\ccSH6mAa.s:216: Error: garbage at end of line lto-wrapper.exe: fatal error: C:\Users\bill\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc returned 1 exit status compilation terminated. c:/users/bill/appdata/local/arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld.exe: error: lto-wrapper failed collect2.exe: error: ld returned 1 exit status exit status 1 Error compiling for board Arduino Mega or Mega 2560.