Go Down

Topic: [PD] puredata to arduino (Read 1 time) previous topic - next topic


Hi, I'm trying to control the Arduino digital out from PureData. I'm using comport in PD to send serial data over the port and I need Arduino to read it and excecute a task. This seems like a realy simple thing to do, but I can't get it to work.
I'm using the Serial Read Advanced example included int the Arduino 003. The TX light turns on in the board when sending data over the port, but no luck with the

Any help would be very apreciated,

adrián goya
int ledPin = 13;  // LED en el pin 13
int val = 0; //variabe para guardar el data del puerto serial
int serbyte = 0;  //variable para guardar el data VALIDO del puerto
void setup()
  pinMode(ledPin, OUTPUT);  
void loop()
  serbyte = serialRead();
    if (val !=  -1) {
   val = serbyte;  
  if (val == 113) {      
  digitalWrite(ledPin, LOW);    
 }  else {
    digitalWrite(ledPin, HIGH);    


Whoops, looks like a bug in that example.  Thanks for finding it.

This code:


   if (val !=  -1) {
  val = serbyte;  
should be:

    if (serbyte !=  -1) {
   val = serbyte;  


Feb 14, 2006, 08:19 am Last Edit: Feb 14, 2006, 08:24 am by adrian_goya Reason: 1
Thank you mellis for the response. I corrected the error you pointed out but it didn't completely fix it.

I also changed the variable declaration in the beginning:

int val = 0;
int serbyte = 0;


char val = 0;
char serbyte = 0;

and now it seems to be working fine.

adrian goya.

note: same story for the Serial Read Basic example.


Thanks for your patience and posting the corrections (and in Spanish too!).  It's been added to the bug database and should be fixed in the next release.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131