Codeanywhere

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

  1. Please make sure to read PIO Remote™ guide first.

  2. You need PIO Account if you don’t have it. Registration is FREE.

  3. You should have a running PIO Remote™ Agent on a remote machine where hardware devices are connected physically or accessible for the remote operations. See PIO Remote Quick Start for details.

Demo

../../_images/ide-codeanywhere-demo.jpg

Integration

  1. Sign in to Codeanywhere. A registration is FREE and gives you unlimited private projects within the one Container.

  2. Open Dashboard Projects

  3. 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.

../../_images/ide-codeanywhere-connection-wizard.png
  1. 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)"
../../_images/ide-codeanywhere-install-pio-cli.png
  1. Log in to PIO Account using platformio account login command.

Quick Start

Let’s create our first PlatformIO-based Codeanywhere Project

  1. 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.

  2. 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);
    }
    
../../_images/ide-codeanywhere-init-project.png
  1. If you prefer to work with PlatformIO Core CLI, then you can process project using Cloud IDE SSH Terminal and the next commands:

  2. We recommend to hide “Hidden Files”. You can do that via Cloud IDE Menu: View > Show Hidden Files.

Run Button

Codeanywhere provides a quick “Run Project” button where you can specify own command. Let’s add “PlatformIO Build Project” command:

  1. Open “Project Config” via right click on Container Name (PlatformIO) > Config

  2. Set commands field to

    "commands": [
        "pio run"
    ]
    
  3. Save configuration file.

Now, try to click on “Run Project” button. You can assign any PlatformIO command to this button.

../../_images/ide-codeanywhere-project-config.png

Remote Device Manager

Remote 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.

  1. Open Cloud IDE SSH Terminal

  2. Paste this command

    pio remote device list
    
../../_images/ide-codeanywhere-ota-devices.png

Remote Firmware Uploading

Remote Firmware Uploading works in pair with PIO Remote™. You can deploy firmware to any devices which are visible for PIO Remote™ Agent.

  1. Open Cloud IDE SSH Terminal

  2. Paste this command

    pio remote run -t upload
    
../../_images/ide-codeanywhere-ota-uploading.png

Remote Serial Port Monitor

Remote 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.

  1. Open Cloud IDE SSH Terminal

  2. Paste this command

    pio remote device monitor
    
../../_images/ide-codeanywhere-ota-serial-monitor.png

Multi-Project workspace

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 remote firmware uploading

    using Project-A

  • pio remote run -d project-B -t upload remote firmware (program) uploading

    using Project-B

See documentation for platformio remote run --project-dir option.