[PD] digital write problem in Pduino

Charles Henry czhenry at gmail.com
Wed Oct 8 18:36:56 CEST 2008


On Wed, Oct 8, 2008 at 10:59 AM, Derek Holzer <derek at umatic.nl> wrote:
> I'm not too skilled with writing code for the Arduino, so I have no way of
> running something standalone right now to see if it can be isolated from the
> board.
>
> I'd really like to have a solution or workaround to this problem, as it's
> quite an unexpected bug!!!!

I actually think you will want to code the metro on the arduino.
Then, pass only messages to the arduino that will tell it how many ms
are between blinks.  You could also write routines for synchronizing a
pair or more of LEDs, triggered my messages.

To code the metros, the arduino has a routine called millis() which
returns the time since the arduino started up.
So, I can envision a routine that looks a little like this:
L1= time in ms between blinks of LED1  ;  T1=time until next blink
.
.
.
L10= time in ms between blinks of LED10  ;  T10=time until next blink

void loop()
{
  now=millis();
  if (now >= T1)
  {
    blink LED1;
    T1=T1+L1;
  }
.
.
.
  if (now >= T10)
  {
    blink LED10;
    T10=T10+L10;
  }
}

That's just a fuzzy idea of how I think you can code it.  There's
probably a bit more timing involved on the side of how long you want
the LED's to blink, and of course the message passing/parsing it takes
to be able to control everything.

Chuck




More information about the Pd-list mailing list