windows-subsystem-for-linuxarduino-esp8266

How would I use Arduino-CLI in WSL?


I recently started playing with an ESP8266 and wanted to try uploading to it using WSL. I found the Arduino-CLI command and followed some tutorials but couldn't figure out how to upload to the board. The command I tried running is arduino-cli upload -p /dev/ttyS5 --fqbn esp8266:esp8266:arduino-esp8266 Testing because I know that the board is an ESP8266 and the is connected to COM5 on the Windows Arduino app. The code compiles and attempts to connect to the board, but cannot get past that part.

This is the code I was trying to upload.

void setup() {
        pinMode(0, OUTPUT);
}

void loop() {
        digitalWrite(0, HIGH);
        delay(1000);
        digitalWrite(0, LOW);
        delay(1000);
}

When I execute arduino-cli board list, it shows this.

Port Protocol Type    Board Name FQBN Core
     serial   Unknown

I'm using Windows Terminal for Ubuntu 20.04 and just installed Arduino-CLI. I also am not sure how to ask stuff cuz it's my first time using StackOverflow, so pls tell me if I'm doing something wrong :)

Edit: So it turns out that I was uploading using the wrong core. I ended up trying every single core listed by arduino-cli board listall esp8266 and it eventually worked with esp8266:esp8266:nodemcuv2 instead of esp8266:esp8266:arduino-esp8266.


Solution

  • Just educated guesses here from my understanding of WSL rather than Arduino.

    I'm assuming that you are using WSL2, which doesn't have access to most Windows hardware, including the serial ports.

    If that's the case, two options that you might try: