brian.bremote.BRemote
- BRemote
BRemote class objects
A paired BRemote controller. Instances are returned by brian.bremote.list().
Button class objects
A button of the remote.
is_pressed
was_just_pressed
Returns:
True if a press edge occurred since the last poll or wait. Consumes the edge (returns False on subsequent calls until the next press).
was_just_released
Returns:
True if a release edge occurred since the last poll or wait. Consumes the edge (returns False on subsequent calls until the next release).
wait_for_press
Waits for the next button press edge.
This function is blocking and abortable from MicroPython.
Arguments:
timeout_ms: Maximum number of milliseconds to wait.- If the timeout is not provided or is None, the function will wait indefinitely.
Raises:
BRemoteDisconnectedError: If the remote disconnects while waiting.
Returns:
success: - True: If the desired button event was caught.
- False: If the timeout ran out or the wait was aborted.
wait_for_release
Waits for the next button release edge.
This function is blocking and abortable from MicroPython.
Arguments:
timeout_ms: Maximum number of milliseconds to wait.- If the timeout is not provided or is None, the function will wait indefinitely.
Raises:
BRemoteDisconnectedError: If the remote disconnects while waiting.
Returns:
success: - True: If the desired button event was caught.
- False: If the timeout ran out or the wait was aborted.
wait_for_press_and_release
Waits for next button press and release event.
This function is blocking and abortable from MicroPython.
Arguments:
timeout_ms: Maximum number of milliseconds to wait.- If the timeout is not provided or is None, the function will wait indefinitely.
Raises:
BRemoteDisconnectedError: If the remote disconnects while waiting.
Returns:
success: - True: If the desired button event was caught.
- False: If the timeout ran out or the wait was aborted.
joystick_btn
Joystick click (press-to-click) button.
aux_btn
Auxiliary button.
power_btn
Power button.
hair_trigger_20
Virtual button: pressed when analog trigger crosses 20%
hair_trigger_50
Virtual button: pressed when analog trigger crosses 50%.
hair_trigger_99
Virtual button: pressed when analog trigger crosses 99%.
is_connected
Returns:
True when this remote is operational and the last OpInput is younger than 200 ms.
is_reconnecting
Returns:
True while Brian is trying to restore a lost link (OpOutput keepalive active).
Set atomically with is_connected when input goes stale or the driver enters
the reconnecting session phase. Cleared when OpInput resumes or the 5-minute
reconnecting deadline expires.
wait_until_connected
Waits until this remote is operational (fresh OpInput). This function is blocking.
Arguments:
timeout_ms: Maximum number of milliseconds to wait.- If the timeout is not provided or is None, the function will wait indefinitely.
Returns:
success: - True: If the remote became connected.
- False: If the timeout ran out or the wait was aborted.
mac_str
age_us
Returns:
Age of the last received packet in microseconds. Returns a very large value (UINT32_MAX) when no packet has ever been received.
total_packets_received
Returns:
Total validated OpInput packets received while the session is operational.
Resets when the ESP-NOW session ends (resetSession).
joystick_x
joystick_y
battery_level
Returns:
Remote controller battery level in percents (0–100). Returns 0 when not connected.
is_battery_charging
Returns:
True when the remote reports that its battery is charging. Returns False when not connected.
is_overheating
Returns:
True when the remote temperature exceeds the overheating threshold. Returns False when not connected.
trigger
Returns:
Current trigger position in range 0.0 ~ 1.0 (analog input, not a digital button).
motion
Returns:
Peak |ax|+|ay|+|az|+|gx|+|gy|+|gz| (g + dps) since the last packet. Returns None when not connected or on IMU I2C error.
play_tone
Play a tone on the remote controller speaker.
Arguments:
tone: Frequency in Hz.duration_ms: Tone duration in milliseconds.