Hi @simonsko. You don't need to make any changes at all to your Arduino Cloud Thing sketches in order to use Arduino IDE to develop, compile, and upload them. So all Arduino Cloud Thing sketch examples can be used with Arduino IDE just the same as Arduino Cloud
The sketch program runs on the Arduino board, not in the IDE, so once the sketch is on the board it is completely irrelevant which development tool happened to be used.
The only parts you can't do via Arduino IDE is:
- Setting up a board as an Arduino IoT Cloud Device
- Configuring the Arduino IoT Cloud Thing
- Configuring the Arduino IoT Cloud dashboard
But these tasks are accomplished very quickly and infrequently. Once you have done that, you can do all further development, compilation, uploading, and debugging on the Thing sketch using Arduino IDE.
Downloading Thing Sketch from Arduino Cloud
Arduino IDE Cloud Sketchbook
Once you have set up a Device and Thing as usual (following this procedure), you only need to download the generated Thing sketch skeleton from Arduino Cloud so that you can open it in Arduino IDE. The most convenient way to do that is using the "Cloud Sketchbook" feature of Arduino IDE 2.x:
Alternative Technique
If you prefer to use Arduino IDE 1.x or some other development tool that doesn't have the Cloud Sketchbook capability, there is an alternative. I'll provide instructions for that:
A. Export Arduino Cloud Thing Sketch
- If you are not already, log in to your Arduino account:
https://login.arduino.cc/login
- Click the following link to open the list of your Arduino Cloud Things in the web browser:
https://app.arduino.cc/things
- Click the name of the Thing.
The "Setup" page for the Thing will open.
- Select the "Sketch" tab at the top of the page.
The "Sketch" page for the Thing will open.
- Click the "</> Open full editor" button on the toolbar.
The Thing sketch will open in Arduino Web Editor (AKA "full editor").
- Click the ●●● button to the right of the board selector on the Arduino Web Editor toolbar.
A menu will open.
- Select "Download Sketch" from the menu.
Your web browser will start a download of the sketch file.
- Unzip the downloaded file.
- Start Arduino IDE.
- Select File > Open... from the Arduino IDE menus.
The "Open" dialog will open.
- Select the
.ino
file from the unzipped folder in the "Open" dialog.
- Click the "Open" button.
B. Network Configuration
To help protect your private information, the network credentials you set on Arduino Cloud are not contained in the Thing sketch when you download it using the procedure I described above. After opening the sketch in Arduino IDE, select the "arduino_secrets.h" tab and set the network credentials there.
For example, you might see something like this in the "arduino_secrets.h" tab when you first open it:
#define SECRET_SSID ""
#define SECRET_OPTIONAL_PASS ""
#define SECRET_DEVICE_KEY ""
You would fill in the network configuration as follows:
#define SECRET_SSID "<Wi-Fi SSID>"
#define SECRET_OPTIONAL_PASS "<Wi-Fi password>"
#define SECRET_DEVICE_KEY "<device key>"
Where <Wi-Fi SSID>
is the SSID name of your Wi-Fi router, <Wi-Fi password>
is the password for the Wi-Fi, and <device key>
is the "secret key" that was provided when you set up the Arduino Cloud Device.
Arduino Cloud CLI
In some advanced use cases, it might be desirable to be able to even configure Devices and Things using a local tool instead of via the convenient Arduino Cloud web interface. Arduino provides a command line tool for that purpose named "Arduino Cloud CLI" . You can learn about it from this tutorial:
Please note that this is a complex tool for advanced users. I recommend using the Arduino Cloud web interface to set up your Devices and Things unless you have a specific reason to prefer an alternative procedure.