You can most certainly use this software with an Arduino Due, but as you said you will need to install the package inside the Arduino software to support the SAM chip on the Due. And you would interact with the Arduino Due via the serial port you mentioned, going through the 32u4 to the computer. You might be able to figure out some way to use the hardware serial ports on the chip itself with something like an FTDI chip on it, but I’m not entirely sure why you’d want to when there’s already a dedicated UART/USB chip on the board itself.
Lastly, I am not familiar with the OpenOCD project enough to say whether or not you can inject features to the code “live”, but a cursory glance at the project tells me probably not. It is certainly a doable task to rewrite some section of the flash memory to add code, but the problem is that it would get pretty complicated, and to my knowledge almost all of said code would need to be written in assembly, as the code you would load into the flash would have to be from a .hex file. You might look at the optiboot loader code on github, as the bootloader for Arduinos does basically what you are describing, “live” loading of code on the device. Note that the specific project I linked to doesn’t support the Due, so you would have to write your own code for the SAM chip. While live loading of code onto a running arduino without resetting is complicated, I can say that the Arduino driver that is currently in Mathematica 10.1.0 (which only supports the Uno at the moment) does support changing a sketch and re-uploading the new sketch completely from within Mathematica. Take a look at the DeviceConfigure section of the documentation. It’s not exactly what you were describing, but it is a lot more convenient than reopening the Arduino software every time you need to change the sketch. We do plan on expanding the builtin functionality to other Arduino boards in the future, but for now it is just the Uno.
Hello Ian,
unfortunately my ideas are way beyond the skill I reacht up to now.
I will try to hook up an arduino micro or nano first, 32u4 / 328P.
Then the due…
The temptation is that DUE is not so limited in pin count as are the small arduinos.
And the limitation of 10bit DAC, beiing noisy as it is, diminishes together with 4kHz usable sample rate the use as aquisition device.
Due would probably stand out there, so I will try.
For you I found a link that mentiones M3 simulation model as open source, so you could swallow it in Mathematica, and it has morphing technology…
The Arduino firmware as I called it in the post is the same thing as a sketch. They are the same.
A Wolfram Language package is a file that contains Wolfram Language code and definitions that is meant to be portable. It is intended that packages contain useful definitions that is to be used multiple times. It is similar to a library file in other programming languages. You load packages with either the function Get or the function Needs. In my post, << is a shorthand notation for Get.
Programming the World with Arduino and Mathematica
In[2]:= arduinoObject = DeviceOpen["Arduino", "COM3"]
Out[2]= DeviceObject[{"Arduino", 1}]
Where "COM4" is my serial port, replace that with whatever port your Arduino is attached on.
Now for some basic device control, we can use
In[15]:= DeviceWrite[arduinoObject, <|11 -> "HIGH"|>]
Out[15]= <|11 -> "HIGH"|>
In[9]:= <|1 -> 1|>
Out[9]= <|1 -> 1|>
Also tested the LED with the insire 3V power supplied to confirm the LED is ok.
sketch to verify everything is ok with the board. At what speed is the Mathematica download running? Does this matter? My Device manager states that arduino receives at 9600 buds.
I think there might have been a problem with the sketch I uploaded. I have modified the sketch, can you try reuploading the sketch?
Additionally, if you have 10.1, you can just use the builtin Arduino functionality (which evolved from this), documented at Arduino—Wolfram Documentation
I’m glad you got it working. And what about the Wolfram guide is too confusing (and I’m assuming by the Wolfram guide you are referring to the documentation page I linked to)?
HEllo… Not much esxciting going on between Mathematica and Arduino. Old firmware FIRMATA does not allow to read all the pins from MEGA. Please, reopen and take over the subject or comment .
– you have earned Featured Contributor Badge
Your exceptional post has been selected for our editorial column Staff Pickshttp://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!
Information for AI agents: this site’s guide is at /llms.txt. Search results are available as JSON from /search.json?q=…; the /search page returns no results to automated clients.