Codeanywhere is a Cross Platform Cloud IDE and it has all the features of Desktop IDE but with additional features only a cloud application can give you! Codeanywhere is very flexible and you can set up your workflow any way you want it. The elegant development environment will let you focus on building great applications quicker. All the features you will need for any coding task are built into Codeanywhere, making development more productive and fun.
Note
Please make sure to read PIO Remote™ guide first.
You need PIO Account if you don’t have it. Registration is FREE.
You should have a running PIO Remote™ Agent on a host machine where hardware devices are connected or visible for remote operations.
Sign in to Codeanywhere. A registration is FREE and gives you unlimited private projects within the one Container.
Open Dashboard Projects
Create a new Project and open it. In Connection Wizard create new Container:
Name set to “PlatformIO”
Stack search for Python
stack (not Python3) that is based on
Ubuntu OS.
Click on “Create” button.
Open SSH-Terminal tab (right click on
Container (PlatformIO) > SSH Terminal
) and install PlatformIO Core using
a next command
sudo python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/develop/scripts/get-platformio.py)"
Log in to PIO Account using platformio account login command.
Let’s create our first PlatformIO-based Codeanywhere Project
Initialize new PlatformIO-based Project. Run a next command in a Cloud IDE SSH Terminal:
platformio init --board <ID>
# initialize project for Arduino Uno
platformio init --board uno
To get board ID
please use platformio boards command or
Embedded Boards Explorer.
If you do not see created project, please refresh Project Tree using
right-click on Container Name (PlatformIO) > Refresh
.
Create new source file named main.cpp
in src
folder using
Project Tree (left side). Please make right click on src
folder,
then “Create File” and insert a next content:
#include <Arduino.h>
int i = 0;
void setup() {
Serial.begin(9600);
Serial.println("Hello Codeanywhere!");
}
void loop() {
/* serial echo */
while (Serial.available()) {
Serial.write(Serial.read());
}
i++;
Serial.println(i);
delay(100);
}
If you prefer to work with PlatformIO Core CLI, then you can process project using Cloud IDE SSH Terminal and the next commands:
platformio run - build project
pio run -t clean - clean project
pio remote run -t upload - upload firmware Over-The-Air
platformio remote device list - list available devices (OTA Device Manager)
platformio remote device monitor - OTA Serial Port Monitor
We recommend to hide “Hidden Files”. You can do that via
Cloud IDE Menu: View > Show Hidden Files
.
Over-The-Air (OTA) Device Manager works in pair with PIO Remote™. You can list remote devices that are connected to host machine where PIO Remote™ Agent is started or are visible for it.
Open Cloud IDE SSH Terminal
Paste this command
pio remote device list
Over-The-Air (OTA) Firmware Uploading works in pair with PIO Remote™. You can deploy firmware to any devices which are visible for PIO Remote™ Agent.
Open Cloud IDE SSH Terminal
Paste this command
pio remote run -t upload
Over-The-Air (OTA) Serial Port Monitor works in pair with PIO Remote™. You can read or send data to any device that is connected to host machine where PIO Remote™ Agent is started. To list active agents please use this command platformio remote agent list.
Open Cloud IDE SSH Terminal
Paste this command
pio remote device monitor
You can have multiple PlatformIO-based Projects in the same workspace. We recommend a next folders structure:
├── project-A
│ ├── lib
│ │ └── readme.txt
│ ├── platformio.ini
│ └── src
│ └── main.ino
└── project-B
├── lib
│ └── readme.txt
├── platformio.ini
└── src
├── main.cpp
└── main.h
In this case, you need to use -d, --project-dir
option for platformio run
or platformio remote run commands:
pio remote run --project-dir project-A -t upload
build Project-A
pio remote run --project-dir project-A -t upload
upload OTA Firmwareusing Project-A
pio remote run -d project-B -t upload
upload OTA Firmwareusing Project-B
See documentation for platformio remote run --project-dir
option.