# Why do I get these errors?

**URL:** <https://forum.arduino.cc/t/why-do-i-get-these-errors/885385>\
**Category:** Programming\
**Created:** [July 15, 2021, 5:19am UTC](https://forum.arduino.cc/t/why-do-i-get-these-errors/885385 "2021-07-15T05:19:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![yossi\_dror](https://avatars.discourse-cdn.com/v4/letter/y/b487fb/32.png) [@yossi\_dror](https://forum.arduino.cc/u/yossi_dror)\
**Post date:** [July 15, 2021, 5:19am UTC](https://forum.arduino.cc/t/why-do-i-get-these-errors/885385/1 "2021-07-15T05:19:35Z")

</div>

Hi,  
I'm trying to set a new code for NANO Every board - starting by setting the board i/o pins for input and outputs but I keep getting the compiler errors all the time ...  
Can you help ??

```cpp
[code]
/*
  Dropper

  Set water drops for Macro photography.
  Set drops size and interval, display the time intervals on LCD ,set camera shutter interval .

  model, check the Technical Specs of your board at:
  https://www.arduino.cc/en/Main/Products

  Edit: Yossi Dror , 14 July 2021

  Modules:
  ARDUINO NANO EVERY board pinout:

  shutter_delay D14 analog input pin
  drop2_delay D15 analog input pin
  drop2_size D16 analog input pin
  drop1_size D17 analog input pin

  Start_drop_sw D2 Digital input pin
  flash_fire_out D7 Digital output pin
  shutter_out D6 Digital output pin
  focus_output D5 Digital output pin
  Solenoid D4 Digital output pin

*/
// constants won't change. They're used here to set pin numbers:
const int Start_drop_sw = D2; // the number of the pushbutton pin
const int Selonoid = D4; // the number of the LED pin
const int Camera_Focus = D5 ; // pin D5 start focusing the camera
const int Camera_Shutter = D6 ; // pin D6 fire the camera
const int Flash_Fire = D7; // pin D7 fire the flash

// variables will change:
int buttonState = 0; // variable for reading the pushbutton status

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
  // initialize digital pins as an output or OUTPUT.
  pinMode (Start_drop_sw, INPUT) ;
  pinMode (Selonoid, OUTPUT) ;
  pinMode (Camera_Focus, OUTPUT);
  pinMode (Camera_Shutter, OUTPUT);
  pinMode (Flash_Fire, OUTPUT );
}
/*
  // the loop function runs over and over again forever
  void loop() {
  digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
  delay(1000); // wait for a second
  digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
  delay(1000); // wait for a second
  }
*/
[/code]

and the error list :

```

Arduino: 1.8.15 (Windows Store 1.8.49.0) (Windows 10), Board: "Arduino Nano Every, None (ATMEGA4809)"

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE\_1.8.49.0\_x86\_\_mdqgnx93n4wtt\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE\_1.8.49.0\_x86\_\_mdqgnx93n4wtt\hardware -hardware C:\Users\yossid\Documents\ArduinoData\packages -hardware C:\Users\yossid\Documents\Arduino\hardware -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE\_1.8.49.0\_x86\_\_mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE\_1.8.49.0\_x86\_\_mdqgnx93n4wtt\hardware\tools\avr -tools C:\Users\yossid\Documents\ArduinoData\packages -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE\_1.8.49.0\_x86\_\_mdqgnx93n4wtt\libraries -libraries C:\Users\yossid\Documents\Arduino\libraries -fqbn=arduino:megaavr:nona4809:mode=off -ide-version=10815 -build-path C:\Users\yossid\AppData\Local\Temp\arduino\_build\_974696 -warnings=none -build-cache C:\Users\yossid\AppData\Local\Temp\arduino\_cache\_882210 -prefs=build.warn\_data\_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Users\yossid\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\yossid\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avr-gcc.path=C:\Users\yossid\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino5.path=C:\Users\yossid\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5 -prefs=runtime.tools.avrdude.path=C:\Users\yossid\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\yossid\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17 -verbose C:\Users\yossid\Documents\Arduino\Projects\Dropper\Dropper.ino

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE\_1.8.49.0\_x86\_\_mdqgnx93n4wtt\arduino-builder -compile -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE\_1.8.49.0\_x86\_\_mdqgnx93n4wtt\hardware -hardware C:\Users\yossid\Documents\ArduinoData\packages -hardware C:\Users\yossid\Documents\Arduino\hardware -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE\_1.8.49.0\_x86\_\_mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE\_1.8.49.0\_x86\_\_mdqgnx93n4wtt\hardware\tools\avr -tools C:\Users\yossid\Documents\ArduinoData\packages -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE\_1.8.49.0\_x86\_\_mdqgnx93n4wtt\libraries -libraries C:\Users\yossid\Documents\Arduino\libraries -fqbn=arduino:megaavr:nona4809:mode=off -ide-version=10815 -build-path C:\Users\yossid\AppData\Local\Temp\arduino\_build\_974696 -warnings=none -build-cache C:\Users\yossid\AppData\Local\Temp\arduino\_cache\_882210 -prefs=build.warn\_data\_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Users\yossid\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\yossid\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avr-gcc.path=C:\Users\yossid\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino5.path=C:\Users\yossid\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5 -prefs=runtime.tools.avrdude.path=C:\Users\yossid\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\yossid\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17 -verbose C:\Users\yossid\Documents\Arduino\Projects\Dropper\Dropper.ino

Using board 'nona4809' from platform in folder: C:\Users\yossid\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.7

Using core 'arduino' from platform in folder: C:\Users\yossid\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.7

Detecting libraries used...

"C:\Users\yossid\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/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=atmega4809 -DF\_CPU=16000000L -DARDUINO=10815 -DARDUINO\_AVR\_NANO\_EVERY -DARDUINO\_ARCH\_MEGAAVR -DMILLIS\_USE\_TIMERB3 -DNO\_EXTERNAL\_I2C\_PULLUP "-IC:\Users\yossid\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/deprecated" "-IC:\Users\yossid\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.7\cores\arduino" "-IC:\Users\yossid\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.7\variants\nona4809" "C:\Users\yossid\AppData\Local\Temp\arduino\_build\_974696\sketch\Dropper.ino.cpp" -o nul

Generating function prototypes...

"C:\Users\yossid\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/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=atmega4809 -DF\_CPU=16000000L -DARDUINO=10815 -DARDUINO\_AVR\_NANO\_EVERY -DARDUINO\_ARCH\_MEGAAVR -DMILLIS\_USE\_TIMERB3 -DNO\_EXTERNAL\_I2C\_PULLUP "-IC:\Users\yossid\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/deprecated" "-IC:\Users\yossid\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.7\cores\arduino" "-IC:\Users\yossid\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.7\variants\nona4809" "C:\Users\yossid\AppData\Local\Temp\arduino\_build\_974696\sketch\Dropper.ino.cpp" -o "C:\Users\yossid\AppData\Local\Temp\arduino\_build\_974696\preproc\ctags\_target\_for\_gcc\_minus\_e.cpp"

"C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE\_1.8.49.0\_x86\_\_mdqgnx93n4wtt\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\yossid\AppData\Local\Temp\arduino\_build\_974696\preproc\ctags\_target\_for\_gcc\_minus\_e.cpp"

Compiling sketch...

"C:\Users\yossid\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/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=atmega4809 -DF\_CPU=16000000L -DARDUINO=10815 -DARDUINO\_AVR\_NANO\_EVERY -DARDUINO\_ARCH\_MEGAAVR -DMILLIS\_USE\_TIMERB3 -DNO\_EXTERNAL\_I2C\_PULLUP "-IC:\Users\yossid\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/deprecated" "-IC:\Users\yossid\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.7\cores\arduino" "-IC:\Users\yossid\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.7\variants\nona4809" "C:\Users\yossid\AppData\Local\Temp\arduino\_build\_974696\sketch\Dropper.ino.cpp" -o "C:\Users\yossid\AppData\Local\Temp\arduino\_build\_974696\sketch\Dropper.ino.cpp.o"

Dropper:28:28: error: 'D2' was not declared in this scope

const int Start\_drop\_sw = D2; // the number of the pushbutton pin

```
                        ^~

```

C:\Users\yossid\Documents\Arduino\Projects\Dropper\Dropper.ino:28:28: note: suggested alternative: 'A2'

const int Start\_drop\_sw = D2; // the number of the pushbutton pin

```
                        ^~

                        A2

```

Dropper:29:28: error: 'D4' was not declared in this scope

const int Selonoid = D4; // the number of the LED pin

```
                        ^~

```

C:\Users\yossid\Documents\Arduino\Projects\Dropper\Dropper.ino:29:28: note: suggested alternative: 'A4'

const int Selonoid = D4; // the number of the LED pin

```
                        ^~

                        A4

```

Dropper:30:28: error: 'D5' was not declared in this scope

const int Camera\_Focus = D5 ; // pin D5 start focusing the camera

```
                        ^~

```

C:\Users\yossid\Documents\Arduino\Projects\Dropper\Dropper.ino:30:28: note: suggested alternative: 'A5'

const int Camera\_Focus = D5 ; // pin D5 start focusing the camera

```
                        ^~

                        A5

```

Dropper:31:28: error: 'D6' was not declared in this scope

const int Camera\_Shutter = D6 ; // pin D6 fire the camera

```
                        ^~

```

C:\Users\yossid\Documents\Arduino\Projects\Dropper\Dropper.ino:31:28: note: suggested alternative: 'A6'

const int Camera\_Shutter = D6 ; // pin D6 fire the camera

```
                        ^~

                        A6

```

Dropper:32:28: error: 'D7' was not declared in this scope

const int Flash\_Fire = D7; // pin D7 fire the flash

```
                        ^~

```

C:\Users\yossid\Documents\Arduino\Projects\Dropper\Dropper.ino:32:28: note: suggested alternative: 'A7'

const int Flash\_Fire = D7; // pin D7 fire the flash

```
                        ^~

                        A7

```

exit status 1

'D2' was not declared in this scope

```cpp

```

---

<div class="post-metadata">

**Author:** ![lastchancename](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/lastchancename/32/215426_2.png) [@lastchancename](https://forum.arduino.cc/u/lastchancename)\
**Post date:** [July 15, 2021, 5:35am UTC](https://forum.arduino.cc/t/why-do-i-get-these-errors/885385/2 "2021-07-15T05:35:33Z")

</div>

Why are the digital pins prefixed with D ?  
Only needed for Analog (A) pins.

---

<div class="post-metadata">

**Author:** ![paulpaulson](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulpaulson/32/363643_2.png) [@paulpaulson](https://forum.arduino.cc/u/paulpaulson)\
**Post date:** [July 15, 2021, 5:36am UTC](https://forum.arduino.cc/t/why-do-i-get-these-errors/885385/3 "2021-07-15T05:36:02Z")

</div>

Hello  
Yes, I can 🤓  
change

```cpp
const int Start_drop_sw = D2; // the number of the pushbutton pin
const int Selonoid = D4; // the number of the LED pin
const int Camera_Focus = D5 ; // pin D5 start focusing the camera
const int Camera_Shutter = D6 ; // pin D6 fire the camera
const int Flash_Fire = D7; // pin D7 fire the flash

```

to

```cpp
const int Start_drop_sw = 2; // the number of the pushbutton pin
const int Selonoid = 4; // the number of the LED pin
const int Camera_Focus = 5 ; // pin D5 start focusing the camera
const int Camera_Shutter = 6 ; // pin D6 fire the camera
const int Flash_Fire = 7; // pin D7 fire the flash

```

and have a nice day.

---

<div class="post-metadata">

**Author:** ![yossi\_dror](https://avatars.discourse-cdn.com/v4/letter/y/b487fb/32.png) [@yossi\_dror](https://forum.arduino.cc/u/yossi_dror)\
**Post date:** [July 15, 2021, 5:37am UTC](https://forum.arduino.cc/t/why-do-i-get-these-errors/885385/4 "2021-07-15T05:37:21Z")

</div>

I will try!!  
thanks a lot

---

<div class="post-metadata">

**Author:** ![flashko](https://avatars.discourse-cdn.com/v4/letter/f/f04885/32.png) [@flashko](https://forum.arduino.cc/u/flashko)\
**Post date:** [July 15, 2021, 7:42am UTC](https://forum.arduino.cc/t/why-do-i-get-these-errors/885385/5 "2021-07-15T07:42:04Z")

</div>

Why 'void loop()' is in commented? No 'void loop()', no compilling code.

> [@yossi\_dror](#):
>
> ```arduino
> /*
> // the loop function runs over and over again forever
> void loop() {
> digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
> delay(1000); // wait for a second
> digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
> delay(1000); // wait for a second
> }
> */
> 
> ```

---

<div class="post-metadata">

**Author:** ![TomGeorge](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/tomgeorge/32/215261_2.png) [@TomGeorge](https://forum.arduino.cc/u/TomGeorge)\
**Post date:** [July 15, 2021, 9:15am UTC](https://forum.arduino.cc/t/why-do-i-get-these-errors/885385/6 "2021-07-15T09:15:34Z")

</div>

Hi, @yossi_dror  
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".

> [@How to get the best out of this forum](https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966):
>
> See also [FAQ - Arduino Forum](https://forum.arduino.cc/faq) for general rules on forum behaviour and etiquette. Hello, Welcome to the Arduino Forum. This guide explains how to get the best out of this forum. Please read and follow the instructions below. Being new here you might think this is having rules for the sake of rules, but that is not the case. If you don’t follow the guidelines all that happens is there is a long exchange of posts while we try to get you to tell us what we need in order to help you, which is fru…

Is this your first Arduino code that you have ever written?

Thanks.. Tom... 😃 👍 ☕ 🇦🇺

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [November 12, 2021, 9:15am UTC](https://forum.arduino.cc/t/why-do-i-get-these-errors/885385/7 "2021-11-12T09:15:57Z")

</div>

Closed on November 12, 2021, 9:15am UTC

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