Total Beginner - error messages when pasting code into Ardui

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
kittenheels
 
Posts: 10
Joined: Sat Apr 16, 2022 10:53 pm

Total Beginner - error messages when pasting code into Ardui

Post by kittenheels »

Hello, please can someone help me. I'm a total beginner to this and have pasted the set up code below into Arduino for the first time so that I can program the flora board.
I followed the set up instructions that are a little different for my mac (e.g. port is auto-selected and cant be changed, etc.) and have pasted the error messages underneath the code hoping someone can help me make sense of what I have done wrong.
Sorry these are really basic questions and not what you are used to :)

Code: Select all

// Pin D7 has an LED connected on FLORA.
// give it a name:
int led = 7;

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}
Arduino: 1.8.19 (Mac OS X), Board: "Adafruit Flora"

Sketch uses 3956 bytes (13%) of program storage space. Maximum is 28672 bytes.
Global variables use 149 bytes of dynamic memory.
Couldn't find a Board on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload.
Invalid library found in /Users/PrincessKelly/Documents/Arduino/libraries/hardware: no headers files (.h) found in /Users/PrincessKelly/Documents/Arduino/libraries/hardware


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: Total Beginner - error messages when pasting code into A

Post by Franklin97355 »

What board and port are you set for? Does the MAC see the flora when it is plugged in? Also, are you sure the USB cable can pass data and not just power? On the Arduino preferences set the compile and upload checkboxes to verbose and see if you have more information.

User avatar
kittenheels
 
Posts: 10
Joined: Sat Apr 16, 2022 10:53 pm

Re: Total Beginner - error messages when pasting code into A

Post by kittenheels »

Hi Franklin, thank you so much for getting back to me.

I have an Adafruit GEMMA v2 flora board.
When I go to Tools menu, the Adafruit Board is visible in the menu options.
When I go to Tools - Ports, there are two options. Serial ports (greyed out) and /dev/cu.Bluetooth-Incoming-Port (not greyed out but doesn't have the "usbmodem" option mentioned in the Adafruit instructions for Mac set up)

I tried to run the basic set up program again and got the following errors (it is a lot, I guess because verbose selected):

Code: Select all

Arduino: 1.8.19 (Mac OS X), Board: "Adafruit Flora"

/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware -hardware /Users/PrincessKelly/Library/Arduino15/packages -tools /private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/tools-builder -tools /private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/PrincessKelly/Library/Arduino15/packages -built-in-libraries /private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/libraries -libraries /Users/PrincessKelly/Documents/Arduino/libraries -fqbn=adafruit:avr:flora8 -ide-version=10819 -build-path /var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/arduino_build_564247 -warnings=none -build-cache /var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/arduino_cache_142908 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avrdude.path=/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.arduinoOTA.path=/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/tools/avr -verbose /Users/PrincessKelly/Documents/Arduino/sketch_apr18a/sketch_apr18a.ino
/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware /private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware -hardware /Users/PrincessKelly/Library/Arduino15/packages -tools /private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/tools-builder -tools /private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/PrincessKelly/Library/Arduino15/packages -built-in-libraries /private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/libraries -libraries /Users/PrincessKelly/Documents/Arduino/libraries -fqbn=adafruit:avr:flora8 -ide-version=10819 -build-path /var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/arduino_build_564247 -warnings=none -build-cache /var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/arduino_cache_142908 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avrdude.path=/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.arduinoOTA.path=/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/tools/avr -verbose /Users/PrincessKelly/Documents/Arduino/sketch_apr18a/sketch_apr18a.ino
Using board 'flora8' from platform in folder: /Users/PrincessKelly/Library/Arduino15/packages/adafruit/hardware/avr/1.4.15
Using core 'arduino' from platform in folder: /private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/arduino/avr
Detecting libraries used...
/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/tools/avr/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=atmega32u4 -DF_CPU=8000000L -DARDUINO=10819 -DARDUINO_AVR_FLORA8 -DARDUINO_ARCH_AVR -DUSB_VID=0x239A -DUSB_PID=0x8004 "-DUSB_MANUFACTURER=\"Adafruit\"" "-DUSB_PRODUCT=\"Flora\"" -I/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Users/PrincessKelly/Library/Arduino15/packages/adafruit/hardware/avr/1.4.15/variants/flora /var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/arduino_build_564247/sketch/sketch_apr18a.ino.cpp -o /dev/null
Generating function prototypes...
/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/tools/avr/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=atmega32u4 -DF_CPU=8000000L -DARDUINO=10819 -DARDUINO_AVR_FLORA8 -DARDUINO_ARCH_AVR -DUSB_VID=0x239A -DUSB_PID=0x8004 "-DUSB_MANUFACTURER=\"Adafruit\"" "-DUSB_PRODUCT=\"Flora\"" -I/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Users/PrincessKelly/Library/Arduino15/packages/adafruit/hardware/avr/1.4.15/variants/flora /var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/arduino_build_564247/sketch/sketch_apr18a.ino.cpp -o /var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/arduino_build_564247/preproc/ctags_target_for_gcc_minus_e.cpp
/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/tools-builder/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/arduino_build_564247/preproc/ctags_target_for_gcc_minus_e.cpp
Compiling sketch...
/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/tools/avr/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=8000000L -DARDUINO=10819 -DARDUINO_AVR_FLORA8 -DARDUINO_ARCH_AVR -DUSB_VID=0x239A -DUSB_PID=0x8004 "-DUSB_MANUFACTURER=\"Adafruit\"" "-DUSB_PRODUCT=\"Flora\"" -I/private/var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/AppTranslocation/F320E1A4-06D8-476E-BD9C-A728A4229381/d/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Users/PrincessKelly/Library/Arduino15/packages/adafruit/hardware/avr/1.4.15/variants/flora /var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/arduino_build_564247/sketch/sketch_apr18a.ino.cpp -o /var/folders/l1/v6wdwr710y77d5123fbnllw40000gn/T/arduino_build_564247/sketch/sketch_apr18a.ino.cpp.o
sketch_apr18a:1:1: error: expected declaration before '}' token
 }
 ^
exit status 1
expected declaration before '}' token
Invalid library found in /Users/PrincessKelly/Documents/Arduino/libraries/hardware: no headers files (.h) found in /Users/PrincessKelly/Documents/Arduino/libraries/hardware
Looks like it has a few things to say. Please let me know what you think.
Thank you very much for helping me!! Kelly
Attachments
Arduino sketch error2.pdf
(56.39 KiB) Downloaded 2 times

User avatar
kittenheels
 
Posts: 10
Joined: Sat Apr 16, 2022 10:53 pm

Re: Total Beginner - error messages when pasting code into A

Post by kittenheels »

Hello, please can you send me a reply. Appreciate it was Easter Holidays but I really need some help with this port problem and was hoping it would be 2 business days for someone to reply :)

User avatar
diaphone
 
Posts: 34
Joined: Thu Apr 21, 2022 8:38 pm

Re: Total Beginner - error messages when pasting code into A

Post by diaphone »

The first error you need to take care of is that errant close brace on the first line of your sketch. This error:
sketch_apr18a:1:1: error: expected declaration before '}' token
That's indicating a problem on line 1 of your sketch, probably just a copy paste error where you selected on line too high from the source, or just accidentally typed that character. Either way, just delete that line and recompile.

User avatar
kittenheels
 
Posts: 10
Joined: Sat Apr 16, 2022 10:53 pm

Re: Total Beginner - error messages when pasting code into A

Post by kittenheels »

Thank you so much, I removed the { and changed the port to the only alternative (cu.Bluetooth-Incoming-Port).

I got much further this time but eventually the error message came back saying
User configuration file is "/Users/PrincessKelly/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
(see attached file last two pages)

And then finally programmer is not responding.
I am fairly sure I purchased the parts exactly per the Adafruit instructions and the green light on the floraboard is lit when I plug in the usb.

Do you have any advice for me please? I am soooo keen to make this work. I'm trying to make the light up trainers with my kids :)
Attachments
error paste 8th may.pdf
(139.55 KiB) Downloaded 4 times

User avatar
diaphone
 
Posts: 34
Joined: Thu Apr 21, 2022 8:38 pm

Re: Total Beginner - error messages when pasting code into A

Post by diaphone »

The config file warning I think is optional and a red herring here. It looks like you don't have a good USB data connection to the board. Do you know the cable is good for data? It's possible for the board to have power but no data, either because the cable's data lines are broken or because you might have grabbed a charging cable that doesn't even have data lines (these exist as USB-to-microUSB cell phone accessories and look just like full USB cables).

User avatar
kittenheels
 
Posts: 10
Joined: Sat Apr 16, 2022 10:53 pm

Re: Total Beginner - error messages when pasting code into A

Post by kittenheels »

Thank you for getting back to me, it is greatly appreciated. I checked with the supplier and the cable is definitely for data. I have a 2nd flora board I will try again with that one in case I have someone broken the first one. I will get back to you asap and let you know if I get the same error message. If you have any other suggestions meantime, please let me know :) Thank you, Kelly

User avatar
kittenheels
 
Posts: 10
Joined: Sat Apr 16, 2022 10:53 pm

Re: Total Beginner - error messages when pasting code into A

Post by kittenheels »

Hello, before I try the 2nd Floraboard I would like some feedback on the following code provided in Overview/ Getting Started (my questions below are in CAPS).
Thank you so much for your help. Kel

1. DOES THE BELOW CODE RUN IN SEQUENCE? I.E. 1ST NAME INT LED THEN 2ND RUN SET UP THEN 3RD RUN LOOP ROUTINE?

// Pin D7 has an LED connected on FLORA.
// give it a name:
int led = 7;
2. THERE IS NO 'D7' ON EITHER FLORABOARD. THERE IS A TINY 'D1' WITH A RED LED THAT LIGHTS BRIEFLY WHEN THE POWER IS CONNECTED, SHOULD I CHANGE THE ABOVE CODE TO 'int led = 1' OR SOMETHING ELSE? PLEASE ADVISE.

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: Total Beginner - error messages when pasting code into A

Post by Franklin97355 »

Are you using a flora or a gemma? You are compiling for a flora, not a gemma.

User avatar
kittenheels
 
Posts: 10
Joined: Sat Apr 16, 2022 10:53 pm

Re: Total Beginner - error messages when pasting code into A

Post by kittenheels »

Hi there it’s a Gemma. When I clicked the link to purchase parts that’s what I ended up with.
Do I need to purchase a different board? If so please can you describe the make/ model.
Or do I need to adjust the code?
Thank you so much for your help and advice I really really appreciate it.

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: Total Beginner - error messages when pasting code into A

Post by Franklin97355 »

On the pdf you included
Arduino: 1.8.19 (Mac OS X), Board: "Adafruit Flora"
You need to select the gemma for the board (or the gemma M0 SAMD21)
Attachments
arduion gemma board.jpg
arduion gemma board.jpg (55.86 KiB) Viewed 240 times

User avatar
kittenheels
 
Posts: 10
Joined: Sat Apr 16, 2022 10:53 pm

Re: Total Beginner - error messages when pasting code into A

Post by kittenheels »

Hi there, please can you send me the link to download the library for GEMMA V2
also, I have subfolders in the /hardware folder should i delete these and move the .h files to the /hardware folder?
See error message below. Kindest Regards, Kelly

Invalid library found in /Users/PrincessKelly/Documents/Arduino/libraries/hardware: no headers files (.h) found in /Users/PrincessKelly/Documents/Arduino/libraries/hardware

User avatar
kittenheels
 
Posts: 10
Joined: Sat Apr 16, 2022 10:53 pm

Re: Total Beginner - error messages when pasting code into A

Post by kittenheels »

error message attached, all good until the last paragraph.
Attachments
error message.pdf
(40.69 KiB) Downloaded 3 times

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: Total Beginner - error messages when pasting code into A

Post by Franklin97355 »

The V2 Gemma is a Tiny85 but the M0 is a different chip just what do you have (picture?) and do you see any Adafruit boards in the board manager? Take a look at this topic https://learn.adafruit.com/add-boards-a ... v164/setup for help.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”