Since the device drivers for Arduino used by DeviceExecute have very poor performance for writing and receiving serial data to/from Arduino compared with the device drivers for a standard serial port I decided to write my own event handler sketch for Arduino.

All works reasonably well: the Arduino listens on the serial port for a number of specified commands + parameters and an appropriate state machine executes some code and returns the result to mathematica via serial. I started writing some functions in Mathematica to automatically generate the C code for the Arduino like with DeviceExecute and would like to upload the code via Mathematica as well.

Mathematica clearly has this ability build-in already (see DeviceConfigure) but the internals are not documented. With the spelunking package I searched through the ArduinoLink namespace and found functions that seem to do all the magic behind the scene but I am lost at the wall of code that are ArduinoConfigureDriver, arduinoUpload, arduinoIndividualUpload and arduinoCompile. Has anybody played with those or another method of uploading to an Arduino from within Mathematica?

  • $\begingroup$ Before ArduinoLink made its way into Mathematica as a built in feature it was distributed via Github. The code is still available, and would perhaps be easier to work with than spelunking. Also the spelunking package is obsolete now that GeneralUtilities`PrintDefinitions is built in. $\endgroup$ – C. E. Mar 16 '16 at 16:45
  • 2
    $\begingroup$ @C.E. As far as I can tell, the source code is available for the built-in ArduinoLink, with comments and everything: SystemOpen@FileNameJoin[{$InstallationDirectory, "SystemFiles", "Links", "ArduinoLink"}] $\endgroup$ – Szabolcs Mar 16 '16 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.