Firmware
With Uniot Core, you don't have to worry about complexity anymore. Task scheduling, networking, storage management, and more - Uniot Core takes care of it all. You just need to describe the functionality of your specific device to unlock its full potential within the Uniot Platform.
We have a library of ready-made templates. Any member of the community can submit their own solution, and we will be happy to review and add it to the library. If there is a ready-made firmware for your device, you can go straight to flashing a device.
Customizing a firmware
For a better understanding of how Uniot Core works, we recommend that you read the related documentation here
Integrating Uniot Core requires only a handful of lines of code, allowing you to focus on your device's unique features without getting bogged down by low-level firmware development.
Setup PlatformIO
Uniot Core employs PlatformIO, an open source ecosystem for IoT development, to manage the project's environment. This includes dependency management, streamlined build processes, and integration with various IDEs, ensuring a smooth development experience. Below is an example of PlatformIO configuration file with two environments (ESP8266 and ESP32):
Hardware common
These modules are required for any device. Include them to utilize Uniot Core.
Definitions
Here you should define all pins used by peripherals. In this example a LED connected to GPIO02 and a button connected to GPIO0.
Tasks
You can define your own tasks to be scheduled and executed at runtime. In this example, there are two tasks that print the free heap and the current time to the Serial.
Setup
This is a standard Arduino function that runs once when the device boots up. Here we initialize the core services, configure the network controller, configure digital and analog inputs and outputs, and describe your own primitives if necessary. Let's dive deeper into each part.
The following code initializes the core services by setting up task schedulers for event handling and date storage:
The next code is the configuration of the network controller. Here we pass the LED pin and the button pin that will be used to indicate the network status and initiate actions such as reconnecting to the network or resetting the network configuration:
The next step is the GPIO pins configuration: Here you should configure digital and analog inputs and outputs. You should describe your own primitives here if necessary.
In this example, we set the LED as a digital output so that we can control its state later in the Visual Editor or in UniotLisp code.
Registers the AppKit with the EventBus:
Pushes the AppKit and your tasks to the Scheduler:
Schedules a task to be executed with a certain frequency:
Attaches the AppKit to the system by initializing default primitives, attaching network and MQTT components, and running stored UniotLisp script:
Loop
This is a standard Arduino function that continuously runs after void setup()
Complete Example
Flashing a device
Once the code is ready, you can build it and flash the device using PlatformIO. You can simply do this with the VSCode extension as shown in the screenshot:
Last updated