To program an Arduino board with Kojo, you need to set up a bridge between Kojo (running on your computer or on a Raspberry Pi) and the Arduino board. This bridge has two components:
- A program called ka_bridge.ino that runs on the Arduino board. This program listens for requests from Kojo and carries them out.
- A file called ka-bridge.kojo that you can include within your Kojo programs. This file contains commands/functions that you can use in your Kojo programs to communicate with ka_bridge.ino running on the Arduino board (to, for example, read sensors and control motors/actuators).
To set up the Kojo-Arduino bridge, you need to do the following:
- Upload ka_bridge.ino to your Arduino board using the Arduino IDE.
- Save ka-bridge.kojo to a directory (let's say ~/kojo-includes) on your machine, so that you can include it within your Kojo programs.
Once the Kojo-Arduino bridge is set up, you can start writing Kojo based Arduino programs.
A bunch of examples are available to help you get going: