Blinky Sample
The Blinky sample is a fundamental "Hello World" example for embedded development that demonstrates basic GPIO control by blinking an LED on your device.
Building the Container
Building the Blinky sample involves three main steps: compiling the application to WebAssembly, packaging it into an Atym container, and pushing it to the Atym Hub.
Building the Application
Navigate to the blinky sample in the Ocre SDK samples directory and create a build directory to compile the application to WebAssembly:
cd ocre-sdk/generic/blinky/
mkdir build && cd build
cmake ..
make
This creates a WASM module named blinky.wasm, that will be used by the atym build command in the next step.
Create the Container
Return to the project root directory and build the Atym container:
cd ..
atym build
If the container creation was successful, you should see a new directory, (.atym) in your home directory (~/.atym). In there, you will find a directory with the container images name and the container contents. In our case, the directory is blinky, as that is the container image name defined in our build.yaml file in the project root.
Push the Container to the Atym Hub
Push your container to the Atym Hub:
atym push blinky
We did not specify a "tag" (e.g. atym push blinky:tag), which will result in this image being tagged as latest.
Deploying the Container
This section shows you how to deploy the Blinky sample container to your device using the Atym CLI.
This example uses deviceName for device identification, which is typically easier to remember and use. You can also use deviceUUID if preferred. To find your device name or UUID, use atym list devices or check the Atym Hub web interface.
Deploy to the Target Device
Deploy the container to your device with the following command, replacing deviceName with your device's name:
atym run blinky blinky -n deviceName
Where the first blinky is your chosen container name, and the next blinky is the IMAGE_REF[:TAG], which is the container image from your registry. In this example we did not specify a tag, and are therefore running the latest tag. This command also requires a device identifier ( -n for deviceName, or -d for deviceUUID).
Verify Deployment
The Atym Hub will deploy your container to the device. You should see the LED on your device blinking, as well as the following output in your console:
atym:~$ Client connected.
Blinky app initializing...
+
.
+
.
+
.
+
.
+
Next Steps
Try modifying the code to change the blink pattern, or explore other samples to learn more about Atym's capabilities.