We will show how you can upload sketches from a Raspberry Pi to your Industruino D21G. While it is possible to run the Arduino IDE on a Raspberry Pi, it is unfortunately not possible to compile and upload sketches to the Industruino at this point, as the Industruino board package does not contain all necessary tools for the Pi platform.
This demo assumes that you have an Arduino IDE running on an Industruino supported platform (Windows, Mac, Linux x86), with the Industruino board package installed as documented here. You can obtain a binary of your compiled sketch by clicking on Sketch > Export compiled Binary. This will put 2 files in your sketch folder e.g.
- blink.ino.industruino_d21g.bin
- blink.ino.with_bootloader.industruino_d21g.bin
/home/tom/.arduino15/packages/industruino/tools/bossac/1.7.0-industruino/bossac-0x4000 -i -d --port=ttyACM0 -U true -i -e -w -v /tmp/arduino_build_797024/blink200ms.ino.bin -R
I compiled 2 different binaries (standard blink on pin 26, the LCD backlight, with 2 different frequencies).
Connect the Industruino to your Pi by USB cable. It should be recognised as port /dev/ttyACM0 - if you want to double check, run $ dmesg
In order to put the Industruino in bootloader mode, so it can accept a new upload, we need to activate the bootloader. This is done in the same way as the Arduino IDE does it: by open/close the port with baud rate 1200. We can do this on the Pi with:
$ stty -F /dev/ttyACM0 ispeed 1200 ospeed 1200
Now the Industruino LCD backlight should be fading in/out, to show that the bootloader is active. We are ready to upload the binary:
$ ./bossac-0x4000 -i -d --port=ttyACM0 -U true -i -e -w -v blink200ms.ino.industruino_d21g.bin -R
This will upload the sketch and start running it.
Remember if you want to upload again, you have to activate the bootloader again with the first command.
If you want to compile your own bossac-0x4000 executable, you can clone this repo.