I wanted to start using the shift register commands and started therefore with the "Lesson 24 Eight LED with 74HC595" that comes with the basic starter kit.
So i set my arduino R3 uno up, as described in the pdf and used the code, they referred to...
//www.elegoo.com
//2016.12.9
int tDelay = 100;
int latchPin = 11; // (11) ST_CP [RCK] on 74HC595
int clockPin = 9; // (9) SH_CP [SCK] on 74HC595
int dataPin = 12; // (12) DS [S1] on 74HC595
byte leds = 0;
void updateShiftRegister()
{
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, leds);
digitalWrite(latchPin, HIGH);
}
void setup()
{
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
}
void loop()
{
leds = 0;
updateShiftRegister();
delay(tDelay);
for (int i = 0; i < 8; i++)
{
bitSet(leds, i);
updateShiftRegister();
delay(tDelay);
}
}
However compiling gave me the following error:
"collect2.exe: error: 1d returned 1 exit status
exit status 1
[An Error has occurred while compiling for] Board Arduino/Genuino Uno."
(As i do not use the english version, i translated the [...] - shouldn’t be to relevant anyways, i guess)
i haven't changed the code at all and am a bit confused as i have no idea what could have went wrong, as i did not find any reasons
When you encounter an error you'll see a button on the right side of the orange bar "Copy error messages". Click that button. Paste the error in a message here using code tags.
Sorry, I just got it how to get the detailed error...
I again translated some parts into english
Arduino: 1.8.1 (Windows 10), Board: "Arduino/Genuino Uno"
[Path+]Arduino\arduino-builder -dump-prefs -logger=machine -hardware [Path+]Arduino\hardware -tools [Path+]Arduino\tools-builder -tools [Path+]Arduino\hardware\tools\avr -built-in-libraries [Path+]Arduino\libraries -libraries C:\Users\Jomann380\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10801 -build-path [Path2+]Local\Temp\arduino_build_79608 -warnings=default -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=[Path+]Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=[Path+]Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=[Path+]Arduino\hardware\tools\avr -verbose C:\Users\Jomann380\Desktop\Arduino\English\code\Lesson 24 Eight LED with 74HC595\Eight_LED_with_74HC595_Flash_LED\Eight_LED_with_74HC595_Flash_LED.ino
[Path+]Arduino\arduino-builder -compile -logger=machine -hardware [Path+]Arduino\hardware -tools [Path+]Arduino\tools-builder -tools [Path+]Arduino\hardware\tools\avr -built-in-libraries [Path+]Arduino\libraries -libraries C:\Users\Jomann380\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10801 -build-path [Path2+]Local\Temp\arduino_build_79608 -warnings=default -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=[Path+]Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=[Path+]Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=[Path+]Arduino\hardware\tools\avr -verbose C:\Users\Jomann380\Desktop\Arduino\English\code\Lesson 24 Eight LED with 74HC595\Eight_LED_with_74HC595_Flash_LED\Eight_LED_with_74HC595_Flash_LED.ino
Using board 'uno' from platform in folder: [Path+]Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: [Path+]Arduino\hardware\arduino\avr
Detecting libraries used...
"[Path+]Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I[Path+]Arduino\hardware\arduino\avr\cores\arduino" "-I[Path+]Arduino\hardware\arduino\avr\variants\standard" "[Path2+]Local\Temp\arduino_build_79608\sketch\Eight_LED_with_74HC595_Flash_LED.ino.cpp" -o "nul"
Generating function prototypes...
"[Path+]Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I[Path+]Arduino\hardware\arduino\avr\cores\arduino" "-I[Path+]Arduino\hardware\arduino\avr\variants\standard" "[Path2+]Local\Temp\arduino_build_79608\sketch\Eight_LED_with_74HC595_Flash_LED.ino.cpp" -o "[Path2+]Local\Temp\arduino_build_79608\preproc\ctags_target_for_gcc_minus_e.cpp"
"[Path+]Arduino\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "[Path2+]Local\Temp\arduino_build_79608\preproc\ctags_target_for_gcc_minus_e.cpp"
Sketch wird kompiliert...
"[Path+]Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I[Path+]Arduino\hardware\arduino\avr\cores\arduino" "-I[Path+]Arduino\hardware\arduino\avr\variants\standard" "[Path2+]Local\Temp\arduino_build_79608\sketch\Eight_LED_with_74HC595_Flash_LED.ino.cpp" -o "[Path2+]Local\Temp\arduino_build_79608\sketch\Eight_LED_with_74HC595_Flash_LED.ino.cpp.o"
Compiling libraries...
Compiling core...
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\wiring_pulse.S.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\WInterrupts.c.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\hooks.c.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\wiring.c.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\wiring_analog.c.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\wiring_digital.c.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\wiring_pulse.c.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\wiring_shift.c.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\CDC.cpp.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\HardwareSerial.cpp.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\HardwareSerial0.cpp.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\HardwareSerial1.cpp.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\HardwareSerial2.cpp.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\HardwareSerial3.cpp.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\IPAddress.cpp.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\PluggableUSB.cpp.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\Print.cpp.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\Stream.cpp.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\Tone.cpp.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\USBCore.cpp.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\WMath.cpp.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\WString.cpp.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\abi.cpp.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\main.cpp.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\new.cpp.o
Previous compiled data will be used: [Path2+]Local\Temp\arduino_build_79608\core\core.a
Linking everything together...
"[Path+]Arduino\hardware\tools\avr/bin/avr-gcc" -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "[Path2+]Local\Temp\arduino_build_79608/Eight_LED_with_74HC595_Flash_LED.ino.elf" "[Path2+]Local\Temp\arduino_build_79608\sketch\Eight_LED_with_74HC595_Flash_LED.ino.cpp.o" "[Path2+]Local\Temp\arduino_build_79608/core\core.a" "-L[Path2+]Local\Temp\arduino_build_79608" -lm
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr5/crtatmega328p.o:(.init9+0x0): undefined reference to `main'
collect2.exe: error: ld returned 1 exit status
exit status 1
[An Error has occurred while compiling for] Board Arduino/Genuino Uno.
I tryed using other programs and saved the tutorial code in another file and now it is running. - I still do not see the reason why it did not work before, but now it is working