Arduino IDE for IoT

Hi
I'd like to use my arduino IDE program from my disk. I try to use online compiler, but somehow I don't like it....
Everything fine until when I need to write sketch for arduino cloud. Do someone have one simple example how to connect on cloud, send data and receive data from cloud?
I'm using ESP8266 and ESP32

thanks!

The code for this is just a few lines for wrapping the data and transmitting it. You best get an example from the IoT service provider.

arduino IoT has only online compiler example.

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

  1. If you are not already, log in to your Arduino account:
    https://login.arduino.cc/login
  2. Click the following link to open the list of your Arduino Cloud Things in the web browser:
    https://app.arduino.cc/things
  3. Click the name of the Thing.
    The "Setup" page for the Thing will open.
  4. Select the "Sketch" tab at the top of the page.
    The "Sketch" page for the Thing will open.
  5. Click the "</> Open full editor" button on the toolbar.
    The Thing sketch will open in Arduino Web Editor (AKA "full editor").
  6. Click the ●●● button to the right of the board selector on the Arduino Web Editor toolbar.
    A menu will open.
  7. Select "Download Sketch" from the menu.
    Your web browser will start a download of the sketch file.
  8. Unzip the downloaded file.
  9. Start Arduino IDE.
  10. Select File > Open... from the Arduino IDE menus.
    The "Open" dialog will open.
  11. Select the .ino file from the unzipped folder in the "Open" dialog.
  12. 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.

Thanks for this. I couldn't find download button, because I got "Agent message"

but when I close it, I got menu now.

thanks for all !
Simon

You are welcome. I'm glad if I was able to be of assistance.

Regards,
Per

Hello. Thansk a lot. Good information. I did as specified. However, 2 files are missing when I compile :slight_smile: #include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
How to download them into the IDE ?
Thanks.
CH

I have just seen that it can be downloaded from ArduinoIoTCloud - Arduino Reference, but do you know which version to sued with IDE ? Regards.
CH

We use a feature of Arduino IDE called "Library Manager" to install libraries. I'll provide instructions you can follow to install the missing libraries:

  1. Select Sketch > Include Library > Manage Libraries... from the Arduino IDE menus to open the "Library Manager" view in the left side panel.
  2. Type ArduinoIoTCloud in the "Filter your search..." field.
  3. Scroll down through the list of libraries until you see the "ArduinoIoTCloud" entry.
  4. You will see an "INSTALL" button at the bottom of the entry. Click the button.
    An "Install library dependencies" dialog will open.
  5. Click the "INSTALL ALL" button in the "Install library dependencies" dialog.
    The dialog will close.
  6. Wait for the installation process to finish, as indicated by a notification at the bottom right corner of the Arduino IDE window:

    ⓘ Successfully installed library ...

Now try compiling your Thing sketch again. Hopefully this time it will work as expected.

1 Like

Good. Many thanks !!!!!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.