# Arduino Maker / compiled robot exercises

Three original AiRO Arduino C++ examples are compiled with the installed Arduino AVR core 1.8.8 for `arduino:avr:uno`, 16 MHz ATmega328P. HEX files exclude the bootloader. Source and HEX digests are in FIRMWARE-SHA256.json. No extra Arduino libraries are required. Corresponding unmodified core/variant sources and build configuration are included in ArduinoCore-avr-1.8.8-source.tar.gz; see LGPL-2.1.txt. Rebuild with `arduino-cli compile --fqbn arduino:avr:uno --output-dir output avoid` (or line/test), using that core version. The original AiRO .ino exercises may be reused under the MIT licence in LICENSE-AIRO.txt. Arduino core licence/provenance: https://github.com/arduino/ArduinoCore-avr (LGPL-2.1); AVR8js: https://github.com/wokwi/avr8js (MIT). Existing website third-party notices apply.

Select Arduino Maker → 3D Build → Run compiled C++ → Avoid / Line / Motors · AVR, then Run circuit. The actual compiled machine instructions run in AVR8js. Open the serial monitor in Circuit & wiring to inspect sensor decisions. Blocks and basic code are still available separately. Download the .ino source, edit with Arduino IDE/CLI, compile for Uno and import the resulting HEX in Code → HEX. Full C++ compilation is not provided inside the browser. Loading a compiled example changes the current program and test arena, not the kit inventory or price.

| Function | Pin |
|---|---|
| L298N ENA / ENB | D5 / D6 PWM |
| L298N IN1 / IN2 / IN3 / IN4 | D7 / D9 / D10 / D11 |
| HC-SR04 TRIG / ECHO | D12 / A1 |
| SG90 signal | D3, centre pulse around 1500 µs |
| IR digital line output | A0, active LOW on black |
| Buzzer | D8 (reserved on Maker UNO) |
| Maker UNO onboard button | D2 reserved; not connected to these exercises |

- Avoid: read echo; advance if clear, turn on no echo or range under 25 cm. Sensor response begins 200 µs after a valid ≥10 µs trigger and uses modelled range ×58 µs. UART reports range and decisions.
- Line: a single offset sensor follows the edge using two motor speeds. It is not a multi-sensor PID controller. Confirm physical sensor polarity before use.
- Motors: forward, reverse, turn, then stop. UART reports each state.

The learning model couples GPIO, PWM duty, current/voltage, motor direction, range, servo and line sensing to one assembled 3D robot. Remove a wire or switch off the motor supply to observe the corresponding effect. Servo pulse timing includes virtual AVR interrupt overhead. Motion is simplified and not a validated motor/tyre/torque prediction. Arena collision is a planar approximation. Buzzer activity is visual/electrical, without audio.

The diagram separates controller 5 V from switched 6 V motor power with a common ground. A physical L298N has voltage drop and regulator-jumper constraints; real motors may need a more suitable supply/driver than this idealised model. Use a suitable regulated servo/sensor supply and verify current, wiring, jumper positions and battery behaviour on the bench. The simulation is not evidence of bench qualification, and these sources must be tested on the exact physical kit before distribution as hardware-ready instructions.

Maker UNO reference: https://www.cytron.io/p-maker-uno-simplifying-arduino-for-education
