









| Pin Name | Description |
|---|---|
| Audio In L | Left channel audio input |
| Audio In R | Right channel audio input |
| Audio Out L | Left channel audio output |
| Audio Out R | Right channel audio output |
| Pin Name | Description |
|---|---|
| AIN0 - AIN7 | Analog input channels 0 to 7 |
| AOUT0 - AOUT7 | Analog output channels 0 to 7 |
| Pin Name | Description |
|---|---|
| GPIO0 - GPIO15 | General-purpose digital I/O pins |
Although Bela is a standalone platform, it can communicate with an Arduino UNO via serial communication. Below is an example of Arduino code to send sensor data to Bela:
// Arduino code to send analog sensor data to Bela via Serial
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 baud
}
void loop() {
int sensorValue = analogRead(A0); // Read sensor value from pin A0
Serial.println(sensorValue); // Send the value to Bela
delay(10); // Small delay to avoid overwhelming the serial buffer
}
On the Bela side, you can use the following C++ snippet to read the data:
// Bela C++ code to read data from Arduino via Serial
#include <Bela.h>
#include <libraries/Serial/Serial.h>
Serial serial;
bool setup(BelaContext *context, void *userData) {
serial.setup("/dev/ttyUSB0", 9600); // Initialize serial communication
return true;
}
void render(BelaContext *context, void *userData) {
while (serial.available() > 0) {
int data = serial.read(); // Read data from Arduino
rt_printf("Received: %d\n", data); // Print the received data
}
}
void cleanup(BelaContext *context, void *userData) {
// Cleanup code if needed
}
rt_printf in Bela to print debug messages to the console.