-->
Page 1 of 1

NodeMCU and VS Code

PostPosted: Sun Mar 01, 2020 9:42 am
by Slugsie
I'm working on a little project with a NodeMCU, fairly typical temperature sensor type of thing reporting in to my own web service.

I got the basics of it working just fine using the Arduino IDE, but I decided to I wanted a more powerful editor, so I moved over to using Visual Studio Code. It works fine, the sketch opens, compiles, and uploads to the board with no issues. VS Code is a vastly better editor than the Arduino IDE could ever be.

Except VS Code flags 2 identifiers as unknown.

Firstly the U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C for the display, and also D7 as a pin definition. In both cases I can mouse over the identifier, press F12, and it will correctly show me the definition from the appropriate header file. (Oddly, for the D7 definition in pins_arduino.h it also marks uint8_t as undefined but will also show its definition when I press F12)

As I said, despite this the sketch compiles, uploads, and runs just fine. I could ignore the error, but my OCD won't let me. ;)

I have the Arduino for Visual Studio Code from Microsoft v0.2.29 (latest version) extension installed, and ESP8266 Community board definitions v2.6.3 installed. I'm using the U8g2 library by Oliver, v 2.27.6.

Anyone got any ideas on this?