Arduino Uno Q and Bridge Tool: any samples and documentation?

A working example based on Blink LED
Python:

#
# SPDX-License-Identifier: MPL-2.0

from arduino.app_utils import *
import time

led_state = False

def fromQRB(data: int):
  print(data)

Bridge.provide("fromQRB", fromQRB)

def loop():
    global led_state
    time.sleep(1)
    led_state = not led_state
    Bridge.call("set_led_state", led_state)

App.run(user_loop=loop)

Sketch:

#include <Arduino_RouterBridge.h>

uint32_t iloop = 0;

void setup() 
{
  
    pinMode(LED3_G, OUTPUT);

    Bridge.begin();
    Bridge.provide("set_led_state", set_led_state);

    delay(5000);
}

void loop() 
{
  
  iloop++;
  Bridge.call("fromQRB", iloop);
  
  delay(2000);
}

void set_led_state(bool state) 

{
    // LOW state means LED is ON
    digitalWrite(LED3_G, state ? LOW : HIGH);
}
4 Likes