I'm having trouble getting the Device functions to work with Arduinio. I'm hoping that someone can help me find out what is wrong. The circuit is very simple, with three resistors and three LEDs. I'm trying to turn them on with pin 5, 6 and 7. This code turns the LEDs on when I upload it via the Arduino software
void setup() {
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
}
void loop() {
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
}
I am now trying to do the same thing with Mathematica.
arduino = DeviceOpen["Arduino", "/dev/tty.usbmodem1431"]
DeviceConfigure[
arduino,
"PinConfigure" -> <|5 -> "Output", 6 -> "Output", 7 -> "Output"|>
]
DeviceWrite[arduino, <|
5 -> 0.5, 6 -> 1, 7 -> 1
|>]
It doesn't work. It seems like whatever code I have previously uploaded to the Arduino is still running. The connection looks alright though:
You can clearly see that the pins are correctly set, but it isn't reflected in what the Arduino actually does. My guess is that the "driver software" that Mathematica uses to control the Arduino hasn't been uploaded, but how can I upload it? Or is it something else?