How cubespace-inha/cubespace-firmware works
This repository contains Arduino firmware for interactive cubes and a sensor/LED pad, plus shared protocol and decision headers. The main workflow runs from pad sensing and cube BLE events through serial messages to a PC app, with PC commands returning through the pad to update cubes and the pad display. The graph preserves documented display, touch/dial, battery, sleep/wake, and infrared-positioning capabilities. Several sketches and helpers were not excerpted; their connections are included only where the README documents them.
Main entry points: cube_fw.ino Cube loop · pad_fw.ino Pad loop · scan.cpp Sensor scan · leds.cpp Pad LEDs
Components 20
Cube firmware
- Cube loop
cube_fw/cube_fw.ino - Face selection
cube_fw/face.h - Eye rendering
cube_fw/eyes.h - Cube display
cube_fw/display.cpp - Sleep and wake
cube_fw/sleep.cpp - Cube pins
cube_fw/pins.h - Dial input
cube_fw/dial.h - Tap input
cube_fw/taps.h - Wake handling
cube_fw/wake.h
Pad firmware
- Pad loop
pad_fw/pad_fw.ino - Sensor scan
pad_fw/scan.cpp - Cube BLE central
pad_fw/cubes.cpp - Pad LEDs
pad_fw/leds.cpp
Shared protocol
- Cube decisions
libraries/CubeSpaceProto/cube_logic.h - BLE protocol
libraries/CubeSpaceProto/cube_pad_protocol.h - PC command parser
libraries/CubeSpaceProto/pad_lines.h - PC line output
libraries/CubeSpaceProto/pad_out.h
Other components
- User
- PC app
- Serial link
Connections 30
- User → Cube loop: touches and moves
README.md - User → Sensor scan: places cubes
README.md - Pad loop → Sensor scan: samples sensors
README.md - Pad loop → Cube BLE central: polls and commands
README.md - Pad loop → Pad LEDs: updates display
README.md - Pad loop → PC command parser: parses commands
README.md - Pad loop → PC line output: formats output
README.md - Sensor scan → PC line output: formats sensor frame
README.md - PC line output → Serial link: emits lines
libraries/CubeSpaceProto/pad_out.h - Serial link → PC app: delivers serial data
README.md - PC app → Serial link: sends commands
README.md - Serial link → PC command parser: supplies commands
libraries/CubeSpaceProto/pad_lines.h - PC command parser → Pad LEDs: provides frame colors
libraries/CubeSpaceProto/pad_lines.h - Sensor scan → Pad LEDs: positions IR marks
README.md - Cube BLE central → BLE protocol: sends commands and receives events
libraries/CubeSpaceProto/cube_pad_protocol.h - Cube loop → BLE protocol: exchanges BLE packets
libraries/CubeSpaceProto/cube_pad_protocol.h - Cube loop → Cube decisions: steps inputs
libraries/CubeSpaceProto/cube_logic.h - Cube decisions → BLE protocol: encodes events
libraries/CubeSpaceProto/cube_logic.h - Cube loop → Face selection: selects presentation
cube_fw/face.h - Face selection → Eye rendering: selects eye state
cube_fw/face.h - Cube loop → Cube display: draws output
README.md - Cube display → Face selection: renders selected face
- Cube loop → Sleep and wake: sleeps and powers off
README.md - Sleep and wake → Cube pins: controls power pins
cube_fw/sleep.cpp - Cube loop → Dial input: reads dial input
README.md - Cube loop → Tap input: classifies taps
README.md - Cube loop → Wake handling: handles wake events
README.md - Cube loop → Cube pins: reads hardware inputs
README.md - Cube loop → Cube BLE central: exchanges cube events
- Pad LEDs → User: shows pad feedback
README.md