Beginners: please read this post and this post before posting to the forum.
0 Members and 1 Guest are viewing this topic.
import processing.serial.*;int i;Serial port;void setup(){println(Serial.list());port = new Serial(this, Serial.list()[4], 9600);}void draw(){ port.write(15); delay(100); println("testing"); }
#include <SoftwareSerial.h>int i;SoftwareSerial mySerial(9,8); //set tx and rx pinsvoid setup(){ //set up serial comunicationmySerial.begin(9600); //speed of serial port used by NewSoftSerial}void loop(){ // read the incoming byte: i = mySerial.read(); //then print it mySerial.print("I Received: "); mySerial.println(i); }
import processing.serial.*;int i;Serial port;void setup(){println(Serial.list());port = new Serial(this, Serial.list()[4], 9600);}void draw(){ port.write(2); delay(1000); println("testing"); }
int incomingByte = 0; // for incoming serial data#include <SoftwareSerial.h>SoftwareSerial mySerial(9,8); void setup() { mySerial.begin(9600); // opens serial port, sets data rate to 9600 bps}void loop() { // send data only when you receive data: if (mySerial.available() > 0) { // read the incoming byte: incomingByte = mySerial.read(); // say what you got: mySerial.print("I Recieved: "); mySerial.println(incomingByte, DEC); }}
int incomingByte = 0; // for incoming serial data#include <SoftwareSerial.h>#include <DynamixelSerial.h>SoftwareSerial mySerial(9,8); void setup() { mySerial.begin(9600); // opens serial port, sets data rate to 9600 bps Dynamixel.begin(1000000,2); // Inicialize the servo at 1Mbps and Pin Control 2}void loop() { // send data only when you receive data: if (mySerial.available() > 0) { // read the incoming byte: incomingByte = mySerial.read(); Dynamixel.moveSpeed(1,incomingByte,300); // Move the Servo 1, 2, and to what is read from the serial port at a move speed Dynamixel.moveSpeed(2,incomingByte,300); //of 300 Dynamixel.moveSpeed(3,incomingByte,300); }}
import processing.serial.*;Serial port;void setup(){println(Serial.list());port = new Serial(this, Serial.list()[4], 9600); }void draw(){ port.write(511); delay(1000); println("testing"); }
unsigned short value = 511;mySerial.write((void *)&value, sizeof(value));
if (mySerial.available() >= 2) { unsigned short value = mySerial.read(); value = value | ((unsigned short)mySerial.read() << 8u); .. use 'value' for the dynamixel ..}