Code
Every sketch, complete and commented
These are the files the books point at. Complete programs rather than fragments, with the wiring each one expects and the traps it avoids written into the comments. Free, no signup — click a filename to open or save it.
Arduino Bluetooth — Make It Connect
- echo.inoThe four-line link test. Anything arriving goes straight back out, so there is no logic that can be wrong. If a letter you type comes back, the radio works.Chapter 4
- at-passthrough.inoTurns the Arduino into a wire between the Serial Monitor and the module, so you can type AT commands at it. The per-module baud rate and line-ending settings are in the comments.Chapter 6
- commands.inoReading single-letter commands, and reading longer messages without them arriving in pieces. Both patterns in one file so you can compare them.Chapter 8
- bluetooth-car.inoA full Bluetooth car. Enables on PWM pins 5 and 6 — putting them anywhere else silently gives you exactly one speed.Chapter 9
Build a Car With Your Kid
- troniction_arduino_car.inoThe sketch running on the real car — motors, buzzer and a tune. Needs pitches.h beside it.The car book
- pitches.hNote definitions used by the car sketch.The car book
- troniction_arduino_car.zipBoth of the above, zipped, if your editor prefers a folder.The car book
Before you upload anything
If your Bluetooth module is wired to pins 0 and 1, unplug its two data wires first. Those pins are the same serial port the USB cable uses to upload, and leaving the module connected makes the upload hang with no error that mentions Bluetooth. Most of these sketches avoid the problem by using other pins.