As you try Arduino example on PlatformIO. PlatformIO may throw many "not declared in this scope" errors. Because PlatformIO require Forward Declaration of function. To fix it, copy to define the function prototype before the functions called, as show in the video.
Edit platformio.ini to add "lib_deps = Wire" to fix the error of "Wire.h: No such file or directory". And specify upload_port if the IDE cannot detect your port.
Build and upload the program to Uno, then open Platform IO Serial Monitor. Once calibration finished, the calibration data will be show in Serial Monitor, copy it.
Here is the result of my board:
*** COPY-PASTE from Serial Terminal:
const int XP=8,XM=A2,YP=A3,YM=9; //240x320 ID=0x9341
const int TS_LEFT=169,TS_RT=941,TS_TOP=176,TS_BOT=927;
Simple Touch to draw example:
Create another Project in Platform IO IDE for simple Touch to draw example, target Arduino Uno.
Replace the calibrate data (copy from the above program) in the code:
Edit platformio.ini to add "lib_deps = Wire" to fix the error of "Wire.h: No such file or directory". And specify upload_port if the IDE cannot detect your port.
It's a 2.8" 320*240 TFT Touch Screen shield, with driver ILI9341 connected using 8 bit parallel interface. Support Arduino UNO and Mega2560 direct plug-in use without wiring.
You can find the details of the TFT Touch Screen Shield from the above link. Also provide Program Download with examples. But I prefer use libraries come with Platform IO IDE. This video show how to:
This exercise run on ESP8266 (NodeMCU), to get current weather data from OpenWeatherMap.
OpenWeatherMap provide easy-to-work weather APIs. Before you can use the APIs, you have to sign-up your account with email, for free.
After sign-up, and email varified, you can get various weather info using APIs with your api key. For example to get current weather:
http://api.openweathermap.org/data/2.5/weather?q=London,uk&APPID=<your key here>
This example with your api key will be sent you in the confirm email. You can paste it in browser, to receive the response in JSON form.
Copy the returned JSON to the input box in ArduinoJson Assistant, it will return you the Memory pool size, and example to Parsing program.
ArduinoJson is a simple and efficient JSON library for embedded C++. Support various platforms of Arduino framework. Already included in Platform IO.
Here is my exercise run on ESP8266 (NodeMCU), to get current weather data from OpenWeatherMap, using libraries ESP8266WiFi, ESP8266HTTPClient, ArduinoJson, and display on I2C OLED using library ESP8266_SSD1306.
Steps to new a PlatformIO project, for NodeMCU board of Arduino framework, using library and example of ESP8266_SSD1306, to display on I2C SSD1306 OLED display. Tested on Windows 10/VirtualBox.
This video show how to install VS Code/PlatformIO IDE on Ubuntu 20.04 (run on Windows 10/VirtualBox), to program Arduino. And also set upload port in platformio.ini and add USB permission to user.
Close and restart VS Code to complete installation.
Now you can select PlatformIO on the left, and create a New Project. For Arduino Uno, steps refer to the above video.
May be you have to specify the upload port in platformio.ini. Open platformio.ini and add the code:
upload_port = /dev/ttyACM0
where /dev/ttyACM0 is the USB port.
Also have to add permission of the USB port to user. Enter the command in Terminal:
$ sudo usermod -a -G dialout <username>
$ sudo chmod a+rw /dev/ttyACM0
Steps to create a new project for NUCLEO-F401RE Board, using Arduino and Mbed framework.
Error: libusb_open() failed with LIBUSB_ERROR_ACCESS
To make PlatformIO run on Ubuntu, in addition to add USB permission to user as describe above, you have to install udev rules (99-platformio-udev.rules) also.
Enter the commands in Terminal:
$ curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/master/scripts/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules
$ sudo service udev restart
After this file is installed, physically unplug and reconnect your board.