Getting Start

Build the environment

Please see the reference for environment construction.

obnizOS plugin

Using obnizOS

obnizOS will not start automatically. It is started by calling obniz.start(). The following is the least complicated program. Once started, obniz will automatically retrieve the device key and connect to the cloud using Wi-Fi or other means.

// Example
#include <obniz.h>

void setup() {
  Serial.begin(115200);
  obniz.start();
}

void loop() {

}

After writing and starting operation from the ArduinoIDE, you need to set the device key from the serial monitor if it is the first device to be written.

Devicekey install

After setting up the device key, you will also need to configure the network.

obnizOS Setting

Using IO

The following will be a program that repeatedly turns IO on and off.

Since all IOs are managed by obniz, you need to remove IOs from the management of obnizOS by obniz.pinReserve() and occupy them with plugins before using them. After that, the operation is no different from the ESP32 program for Arduino.

In the following example, IO 12 turns on and off every 0.5 seconds, so if you connect an LED, it will blink regardless of obnizOS.

#include <obniz.h>

void setup() {
  Serial.begin(115200);
  obniz.start();
  obniz.pinReserve(12);
  pinMode(12, OUTPUT);
}

void loop() {
  digitalWrite(12, HIGH);
  delay(500);
  digitalWrite(12, LOW);
  delay(500);
}

Let's write this code to the ESP32 board using the ArduinoIDE in build environment.

Although it is not used this time, pin 12 cannot be controlled from the obniz.js side. This is to prevent obnizOS from resetting the board at an unintended time and losing control.

It can also be opened intentionally, so please see the documentation for details.
macos/deepLFree.translatedWithDeepL.text