pmarct
Posts: 2
Joined: Wed Mar 25, 2020 4:39 pm

Wirelessly receive and compile teensy/arduino code

Wed Mar 25, 2020 4:45 pm

So the project consists of two rasberry pis that are connected via wifi through a server-client relationship. One of the pis is connected to a teensy microcontroller and the other pi is strictly used to send commands and new code.

So far I can send and receive data/files between the two pis via Python sockets. However, I need to create a script that receives the new teensy/arduino code file and automatically compiles and uploads it to the teensy via the command line.

I've searched this countless times and haven't found a clear way of doing this, could anyone help or point me in the right direction?

User avatar
neilgl
Posts: 2185
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Wirelessly receive and compile teensy/arduino code

Wed Mar 25, 2020 5:01 pm

Have you looked at arduino-cli

PiGraham
Posts: 3939
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Wirelessly receive and compile teensy/arduino code

Wed Mar 25, 2020 5:08 pm

Agreed, use the commandline tool for Arduino, not the IDE.

Then you can send the source file, build it and upload it to the Teensy. all from a shell script or ox.popen calls from Python .

https://github.com/arduino/arduino-cli
To compile the sketch you run the compile command passing the proper FQBN string:

$ arduino-cli compile --fqbn arduino:samd:mkr1000 MyFirstSketch
Sketch uses 9600 bytes (3%) of program storage space. Maximum is 262144 bytes.

To upload the sketch to your board, run the following command, this time also providing the serial port where the board is connected:

$ arduino-cli upload -p /dev/ttyACM0 --fqbn arduino:samd:mkr1000 MyFirstSketch

pmarct
Posts: 2
Joined: Wed Mar 25, 2020 4:39 pm

Re: Wirelessly receive and compile teensy/arduino code

Wed Apr 01, 2020 4:01 pm

Can you use arduino cli for teensy? I am using a 4.0 and I don't even think teensy cli supports the 4.0 yet

PiGraham
Posts: 3939
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Wirelessly receive and compile teensy/arduino code

Fri Apr 03, 2020 10:13 am

I don't know. Have you tried?

It's a Teensy issue so you could try the Teensy forums.

Return to “Advanced users”