[PD] Pduino and shift registers

school shoes schoolshoes at outlook.com
Mon Jul 1 02:33:50 CEST 2019


Hey, no worries. The only indication to me was the very brief reference to it in the forum post i linked to, and the line in the firmata.h file:

#define SHIFT_DATA              0x75 // a bitstream to/from a shift register


So thought I’d ask on the off chance it was an undocumented feature . . .

I'm sure it is possible to hack together the shiftOut() function in pd, though as I’m not a programmer how to do that is not immediately obvious to me,* so guess i was hoping that there was a ‘proper’ or more efficient way to do it via pduino.

As you suggest it’s probably better to do the shift register stuff directly on the arduino, but i’m already in quite deep with pduino for this particular project. .

anyway, thanks for your replies !

*source code for shiftOut():

void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val)
{
uint8_t i;

for (i = 0; i < 8; i++)  {
 if (bitOrder == LSBFIRST)
  digitalWrite(dataPin, !!(val & (1 << i)));
 else
  digitalWrite(dataPin, !!(val & (1 << (7 - i))));

 digitalWrite(clockPin, HIGH);
 digitalWrite(clockPin, LOW);
}
}


________________________________
From: Pd-list <pd-list-bounces at lists.iem.at> on behalf of Roman Haefeli <reduzent at gmail.com>
Sent: Monday, 1 July 2019 3:21 AM
To: pd-list at lists.iem.at
Subject: Re: [PD] Pduino and shift registers

On Sat, 2019-06-29 at 14:23 +0200, Simon Iten wrote:
> i think you should be able to control a shift register
>  from pd within the existing architecture.
>
> if you can access those 3 pins from pd just send them the HIGHs and
> LOWs you would send in arduino code…

Theoretically yes, but it's probably slow and unreliable. If you could
just send the desired bit states from Pd and let the Arduino deal with
timing and ordering, data transmission would have less overhead would
likely be more reliable.

One could still write a little code snippet for the Arduino and an
complementary abstraction based on comport to do something like this.
Right now, I would not know how to make that part of Firmata and
pduino.

Roman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20190701/ab5a16c9/attachment.html>


More information about the Pd-list mailing list