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 Remote Development guide first.
You need PlatformIO Account if you don’t have it. Registration is FREE.
You should have a running PlatformIO Remote Agent on a remote machine where hardware devices are connected physically or accessible for the remote operations. See Remote Development Quick Start for details.
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 (CLI) using
a next command
sudo python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/develop/scripts/get-platformio.py)"
Log in to PlatformIO 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 project init --board <ID>
# initialize project for Arduino Uno
platformio project 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) CLI, then you can process project using Cloud IDE SSH Terminal and the next commands:
platformio run - build project locally (using Cloud IDE’s virtual machine)
pio run -t clean - clean project
pio remote run -t upload - upload firmware (program) to a remote device
platformio remote device list - list available remote devices
platformio remote device monitor - Remote Serial Port Monitor
We recommend to hide “Hidden Files”. You can do that via
Cloud IDE Menu: View > Show Hidden Files
.
Remote Device Manager works in pair with Remote Development. You can list remote devices that are connected to host machine where PlatformIO Remote Agent is started or are visible for it.
Open Cloud IDE SSH Terminal
Paste this command
pio remote device list
Remote Firmware Uploading works in pair with Remote Development. You can deploy firmware to any devices which are visible for PlatformIO Remote Agent.
Open Cloud IDE SSH Terminal
Paste this command
pio remote run -t upload
Remote Serial Port Monitor works in pair with Remote Development. You can read or send data to any device that is connected to host machine where PlatformIO 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
│ ├── platformio.ini
│ └── src
│ └── main.ino
└── project-B
├── lib
│ └── README
├── 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
remote firmware uploadingusing Project-A
pio remote run -d project-B -t upload
remote firmware (program) uploadingusing Project-B
See documentation for platformio remote run --project-dir
option.