Georg Holzmann wrote:
Hallo!
I'm playing around with the latest arduino object for pd, and it seems that there is a disconnect between the numbering for port I/O data-direction, and setting the value of a pin. I'm using the arduino-test.pd patch, as well as the [pd DIGITAL-OUTPUT] behavior pulled from the arduino help patch.
I don't really understand this - you mean you can set input/output mode for pin 13 with toggle 6 (and please try it in the help-patch) ?
Hi Georg,
What I'm confused about is that usually in microcontroller programming, there is a symmetry between setting the data direction of a pin (i.e. input or output), and setting/clearing a bit on that pin. For instance, in AVR C, if I want to assert a HIGH voltage on pin D0, I would write:
DDRD = 0x01; // set data direction for pin 0, port D to output PORTD |= 0x01; // set value of pin 0, port D to HIGH
..so the same value is used both to set the data direction and set the bit on the pin. That's what I'm confused about the example patch for arduino - where the same number does not get passed for data direction as for pin setting (see my previous attached .jpg). It's probably because I didn't dig into the example to see why this mapping is different - but since arduino/pduino is supposed to be good for physical computing students who know little about the nitty-gritty details of hardware/software integration, it should be as straightforward as possible.
The patch in the .jpg that I sent is the arduino-test.pd, with the "I/O the individual pins" section taken from arduino-help.pd. I'm pretty sure I have the latest pduino firmware - I downloaded from HCS's website directly yesterday. thanks, -David
p.s. also, clicking the "pulse all outputs" box in arduino-test.pd crashes PD after a few seconds - I suspect due to a comport problem..
Do you have the latest firmware and have you tried the PWN-OUT of the help patch?
LG Georg