Property 'upload.tool.serial' is undefined

Hi, this is my first time trying anything like this. I am following a YouTube tutorial currently and running into an error when I try to upload my sketch. As I cannot upload attachments I'll paste the error in. Thanks for any help in advance.

FQBN: arduino:avr:myboard
Using board 'myboard' from platform in folder: C:\Users\Deaco\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.8
Using core 'arduino' from platform in folder: C:\Users\Deaco\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.8

Detecting libraries used...
Using cached library dependencies for file: C:\Users\Deaco\AppData\Local\arduino\sketches\5E1ED4F7BC9EB732799AADC3EC3D58C0\sketch\sketch_oct9a.ino.cpp.merged
Alternatives for SwitchJoystick.h: [SwitchJoystick@1.0.0]
ResolveLibrary(SwitchJoystick.h)
  -> candidates: [SwitchJoystick@1.0.0]
Using cached library dependencies for file: C:\Users\Deaco\OneDrive\Documents\Arduino\libraries\SwitchJoystick\src\DynamicHID\DynamicHID.cpp
Using cached library dependencies for file: C:\Users\Deaco\OneDrive\Documents\Arduino\libraries\SwitchJoystick\src\SwitchJoystick.cpp
Generating function prototypes...
Using cached sketch with function prototypes.
Compiling sketch...
Using previously compiled file: C:\Users\Deaco\AppData\Local\arduino\sketches\5E1ED4F7BC9EB732799AADC3EC3D58C0\sketch\sketch_oct9a.ino.cpp.o
Compiling libraries...
Compiling library "SwitchJoystick"
Using previously compiled file: C:\Users\Deaco\AppData\Local\arduino\sketches\5E1ED4F7BC9EB732799AADC3EC3D58C0\libraries\SwitchJoystick\DynamicHID\DynamicHID.cpp.o
Using previously compiled file: C:\Users\Deaco\AppData\Local\arduino\sketches\5E1ED4F7BC9EB732799AADC3EC3D58C0\libraries\SwitchJoystick\SwitchJoystick.cpp.o
Compiling core...
Using precompiled core: C:\Users\Deaco\AppData\Local\arduino\cores\arduino_avr_myboard_d4917856f38c2b967ebb0aa313ff967a\core.a
Linking everything together...
"C:\\Users\\Deaco\\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=atmega32u4 -o "C:\\Users\\Deaco\\AppData\\Local\\arduino\\sketches\\5E1ED4F7BC9EB732799AADC3EC3D58C0/sketch_oct9a.ino.elf" "C:\\Users\\Deaco\\AppData\\Local\\arduino\\sketches\\5E1ED4F7BC9EB732799AADC3EC3D58C0\\sketch\\sketch_oct9a.ino.cpp.o" "C:\\Users\\Deaco\\AppData\\Local\\arduino\\sketches\\5E1ED4F7BC9EB732799AADC3EC3D58C0\\libraries\\SwitchJoystick\\DynamicHID\\DynamicHID.cpp.o" "C:\\Users\\Deaco\\AppData\\Local\\arduino\\sketches\\5E1ED4F7BC9EB732799AADC3EC3D58C0\\libraries\\SwitchJoystick\\SwitchJoystick.cpp.o" "C:\\Users\\Deaco\\AppData\\Local\\arduino\\sketches\\5E1ED4F7BC9EB732799AADC3EC3D58C0/..\\..\\cores\\arduino_avr_myboard_d4917856f38c2b967ebb0aa313ff967a\\core.a" "-LC:\\Users\\Deaco\\AppData\\Local\\arduino\\sketches\\5E1ED4F7BC9EB732799AADC3EC3D58C0" -lm
"C:\\Users\\Deaco\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\Deaco\\AppData\\Local\\arduino\\sketches\\5E1ED4F7BC9EB732799AADC3EC3D58C0/sketch_oct9a.ino.elf" "C:\\Users\\Deaco\\AppData\\Local\\arduino\\sketches\\5E1ED4F7BC9EB732799AADC3EC3D58C0/sketch_oct9a.ino.eep"
"C:\\Users\\Deaco\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\Deaco\\AppData\\Local\\arduino\\sketches\\5E1ED4F7BC9EB732799AADC3EC3D58C0/sketch_oct9a.ino.elf" "C:\\Users\\Deaco\\AppData\\Local\\arduino\\sketches\\5E1ED4F7BC9EB732799AADC3EC3D58C0/sketch_oct9a.ino.hex"
Using library SwitchJoystick at version 1.0.0 in folder: C:\Users\Deaco\OneDrive\Documents\Arduino\libraries\SwitchJoystick 
"C:\\Users\\Deaco\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\Deaco\\AppData\\Local\\arduino\\sketches\\5E1ED4F7BC9EB732799AADC3EC3D58C0/sketch_oct9a.ino.elf"
Sketch uses 10488 bytes (36%) of program storage space. Maximum is 28672 bytes.
Global variables use 516 bytes (20%) of dynamic memory, leaving 2044 bytes for local variables. Maximum is 2560 bytes.
Property 'upload.tool.serial' is undefined

Sorry, I should specify I am using a Nano Every Board.

My first two steps when I get strange errors in my IDE (2.3.10) are:

(1) exit and re-launch the IDE (that fixes all but a couple of my problems), and
(2) uninstall/install the board package (Arduino Nano Every?).

  • IDE >> TOOLS >> BOARD >> BOARD MANAGER >> (find your board) >> REMOVE
  • IDE >> TOOLS >> BOARD >> BOARD MANAGER >> (find your board) >> INSTALL

if @xfpd 's suggestion doesn't work, you will have to edit the boards.txt file manually

search for a file boards.txt in

C:\Users\Deaco\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.8

this file should have a section for your mcu (for the every the settings should be starting with nona4809 but that may vary)

add the line:

nona4809.upload.tool.default=avrdude

note: replace the nona4809 with the prefix in the nano every section if different

then restart the ide and see if it works

Where does myboard come from?

It looks like you're compiling for an AVR chip instead of a megaAVR; see below

Not sure if I can help further.

you may also need to add the line

nona4809.upload.protocol= jtag2updi

Hi, sorry still looking for the correct section to add that line. doesn't look like my board has the same prefix for the settings so I'm kind of lost now. I'll get back to you once I figure it out.

Okay it looks like my prefix is atmega328p which upon googling I'm being told that's for an older board but I definitely bought a Nano Every I have the box infront of me. I have the right packages installed for the Every as well. Is there a reason why my boards.txt folder thinks it's an older board?

my mistake, the boards.txt path should be:

C:\Users\Deaco\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8

the section name is

nona4809.name=Arduino Nano Every

Oh never mind I found the megaavr folder... I feel dumb. Hope I can get this working now

if the nona4809.upload.tool.default=avrdude exists try adding

nona4809.upload.tool.serial=avrdude

then restart

Getting a new error now

FQBN: arduino:megaavr:myboard
Using board 'myboard' from platform in folder: C:\Users\Deaco\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8
Using core 'arduino' from platform in folder: C:\Users\Deaco\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8

Detecting libraries used...
C:\Users\Deaco\AppData\Local\Arduino15\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=10607 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_MEGAAVR -DUSB_VID=0x0F0D -DUSB_PID=0x0092 -DUSB_MANUFACTURER="HORI CO.,LTD." -DUSB_PRODUCT="POKKEN CONTROLLER" -IC:\Users\Deaco\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\cores\arduino/api/deprecated -IC:\Users\Deaco\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\cores\arduino -IC:\Users\Deaco\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\variants\leonardo C:\Users\Deaco\AppData\Local\arduino\sketches\5E1ED4F7BC9EB732799AADC3EC3D58C0\sketch\sketch_oct9a.ino.cpp.merged -o nul -MMD -MF C:\Users\Deaco\AppData\Local\arduino\sketches\5E1ED4F7BC9EB732799AADC3EC3D58C0\sketch\sketch_oct9a.ino.cpp.merged.libsdetect.d
In file included from C:\Users\Deaco\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\cores\arduino/Arduino.h:140:0,
                 from C:\Users\Deaco\AppData\Local\arduino\sketches\5E1ED4F7BC9EB732799AADC3EC3D58C0\sketch\sketch_oct9a.ino.cpp.merged:1:
C:\Users\Deaco\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\cores\arduino/UART.h:28:10: fatal error: pins_arduino.h: No such file or directory
 #include "pins_arduino.h"
          ^~~~~~~~~~~~~~~~
compilation terminated.
Alternatives for pins_arduino.h: []
ResolveLibrary(pins_arduino.h)
  -> candidates: []
exit status 1

Compilation error: exit status 1

I have a feeling this might be because of the board I'm trying to add to myboards.txt is coded for an older board but in all honestly I have no clue

ok, this is progress

now look into the C:\Users\Deaco\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\variants\nona4098

I have these 3 files. Do you?

Yeah I have the same packages

copy the file "pins_arduino.h" to your sketch file directory

#include "pins_arduino.h"

means the file is local to your project directory

#include <pins_arduino.h>

should work too and it means the file is in the standard include path

I added it to my sketch but getting the same error. Is there anything I can send over, like my sketch or something, that would help give you a better insight?

feel free to post your sketch in this thread. Please make sure to use the tags

Hope I've done this right,

#include <pins_arduino.h>

#include <SwitchJoystick.h>

SwitchJoystick_ SwitchJoystick;

String inputBuffer = "";

void setup() {
  Serial.begin(115200);       // debug / echoes
  Serial1.begin(115200);      // Pi communication
  SwitchJoystick.begin();
  Serial.println("Arduino ready");
}

void loop() {
  while (Serial1.available()) {
    char c = Serial1.read();
    if (c == '\n' || c == '\r') {
      inputBuffer.trim();
      if (inputBuffer.length() > 0) {
        processCommands(inputBuffer);
      }
      inputBuffer = "";
    } else {
      inputBuffer += c;
    }
  }
}

// Handles multiple commands in one line or comma-separated buttons
void processCommands(String cmds) {
  int start = 0;
  for (int i = 0; i < cmds.length(); i++) {
    if (i + 6 < cmds.length() && 
        (cmds.substring(i, i + 6) == "PRESS:" ||
         cmds.substring(i, i + 5) == "DPAD:" ||
         cmds.substring(i, i + 6) == "STICK:")) {
      if (i != 0) {
        String cmd = cmds.substring(start, i);
        handleCommand(cmd);
        start = i;
      }
    }
  }
  handleCommand(cmds.substring(start));
}

// Actual command handler
void handleCommand(String cmd) {
  cmd.trim();
  Serial.print("CMD RECEIVED: ");
  Serial.println(cmd);

  if (cmd.startsWith("PRESS:")) {
    String btns = cmd.substring(6);
    int s = 0;
    int comma = btns.indexOf(',');
    while (comma != -1) {
      int idx = btns.substring(s, comma).toInt();
      SwitchJoystick.pressButton(idx);
      delay(10);
      Serial.print("Button pressed: ");
      Serial.println(idx);
      s = comma + 1;
      comma = btns.indexOf(',', s);
    }
    if (s < btns.length()) {
      int idx = btns.substring(s).toInt();
      SwitchJoystick.pressButton(idx);
      Serial.print("Button pressed: ");
      Serial.println(idx);
    }
  } 
  else if (cmd == "RELEASE") {
    for (int i = 0; i < 16; i++) SwitchJoystick.releaseButton(i);
    SwitchJoystick.setXAxis(128);
    SwitchJoystick.setYAxis(128);
    SwitchJoystick.setZAxis(128);
    SwitchJoystick.setRzAxis(128);
    Serial.println("All released");
  } 
  else if (cmd.startsWith("DPAD:")) {
    int angle = cmd.substring(5).toInt();
    SwitchJoystick.setHatSwitch(angle);
    Serial.print("DPad angle: ");
    Serial.println(angle);
  } 
  else if (cmd.startsWith("STICK:")) {
    int first = cmd.indexOf(':', 6);
    int second = cmd.indexOf(':', first + 1);
    String side = cmd.substring(6, first);
    int x = cmd.substring(first + 1, second).toInt();
    int y = cmd.substring(second + 1).toInt();
    if (side == "LEFT") {
      SwitchJoystick.setXAxis(x);
      SwitchJoystick.setYAxis(y);
    } else {
      SwitchJoystick.setZAxis(x);
      SwitchJoystick.setRzAxis(y);
    }
    Serial.println("Stick updated: " + cmd);
  }
}

which SwitchJoystick library are you using?

I'm following this tutorial https://www.youtube.com/watch?v=ollgCfyOFAM

which uses this library https://github.com/squirelo/Arduino-JoyCon-Library-for-Nintendo-Switch

and uses this guys sketch https://github.com/AlexSDevDump/SwitchShinyBot/blob/main/SwitchController.ino