We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpElectronics,  Serial Library › How to send commands to serial, please help
Page Index Toggle Pages: 1
How to send commands to serial, please help (Read 2184 times)
How to send commands to serial, please help
Nov 30th, 2009, 1:12pm
 
Hi there,

i would like to send commands to my SD84 servo controller and get no results   Embarrassed  
The card i like to use is an FTDI driven USB tool for 84 servo motors
> robot-electronics.co.uk/htm/sd84tech.htm.

1. I can´t configure the serial settings ??? what the hell ..

Is this the right way?..:

myPort = new Serial(this, Serial.list() [1], 115200, 8, N, 2.0);

Serial(parent, name, rate, parity, databits, stopbits)

Why i get the error (Cannot find anything named "N" )??

2.  How i can send an Array like this to the Serial {0xAA0xA0, 0x55, 0x01, 0x01, 0x02, 0xDC, 0x05}?

Pleas let me roger that.

Greetings from Germany
Re: How to send commands to serial, please help
Reply #1 - Dec 3rd, 2009, 5:11pm
 
hey, I'm certainly no expert, but... unless your device explicitly requires all of that configuration, you may be able to get away with out it.

Code:
myPort = new Serial(this, Serial.list()[1], 115200); 



Failing that, try enclosing the the N in quotes,

Code:
myPort = new Serial(this, Serial.list()[1], 115200, 8, "N", 2.0); 



I hope that's helpful. It may not be. Smiley
Re: How to send commands to serial, please help
Reply #2 - Dec 5th, 2009, 3:14am
 
Oh thanks, the serial port receive the signal and a green and red LED light up. But the servo does not react Undecided

How i can send the whole array at once???  Embarrassed
Re: How to send commands to serial, please help
Reply #3 - Dec 5th, 2009, 10:35am
 
OK, thats the way by sending all bytes as a single command.

I think, it is much more faster to send every bytes of one command string as a whole thing. But i don't know how...  

import processing.serial.*;

Serial myPort;  // Create object from Serial class


void setup()
{
 size(200, 200);
 // I know that the first port in the serial list on my mac
 // is always my  FTDI adaptor, so I open Serial.list()[0].
 // On Windows machines, this generally opens COM1.
 // Open whatever port is the one you're using.
 String portName = Serial.list()[0];
 myPort = new Serial(this, Serial.list()[0], 115200, 'N', 8, 2.0);
 
}

void draw() {
 background(255);
 noLoop();
               
   myPort.write(0xAA);
   myPort.write(0xA0);
   myPort.write(0x55);
   myPort.write(0x04);
   myPort.write(1);
   myPort.write(1);
   myPort.write(25);
   
   
   myPort.write(0xAA);
   myPort.write(0xA0);
   myPort.write(0x55);
   myPort.write(0x01);
   myPort.write(0x01);
   myPort.write(0x02);
   myPort.write(0xDC);
   myPort.write(0x05);

   int feedback = myPort.lastChar();
   println (feedback);
}
Re: How to send commands to serial, please help
Reply #4 - Dec 5th, 2009, 12:05pm
 
is there anyway to cut the transmission speed down?

myPort = new Serial(this, Serial.list()[0], 115200, 'N', 8, 2.0);
                                                                /\
                                                                 |
Re: How to send commands to serial, please help
Reply #5 - Dec 6th, 2009, 4:20am
 
Generally this is no problem to set the parameter to 9600 for example. But my device is a SD84 controller card to adjust up to 84 servos or less than 84 and therefor get signals from analog input channels.

http://www.robot-electronics.co.uk/htm/sd84tech.htm
Page Index Toggle Pages: 1