 by nicolas gomez » Thu Jan 10, 2013 8:54 pm
                by nicolas gomez » Thu Jan 10, 2013 8:54 pm
            
            
                     by nicolas gomez
                by nicolas gomez
Thu Jan 10, 2013 8:54 pm
            
            
            Hi
here a sam3 servo with arduino UNO
At 1-second intervals SAM3 back and forth between the position values of 20 and 120.
Realistically UNO board power simply turning the servo one I use works fine.
Lines connect the UNO R3 connection has been so from the board.
VCC of 5V ~ SAM3
TX (DIGITAL 1 time) ~ SAM3 of RX
RX (DIGITAL 2 times) SAM3 of TX
GND GND ~ SAM3
/*
  Blink & SAM Control
  Turns on an LED and changes a SAM position on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */
 
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
// for SAM control
int id;        // SAM id
int torq;      // torque level(0:max, 4:min)
int checksum;  // protocol checksum
int tmp1, tmp2;      // temporary byte
// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
  // start serial port at 115200 bps:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  id = 0;
  torq = 2;
}
// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  tmp1 = (torq << 5) | id;
  tmp2 = 20;                  // position1
  checksum = (tmp1 ^ tmp2) & 0x7f;
  Serial.write(0xff);
  Serial.write(tmp1);
  Serial.write(tmp2);
  Serial.write(checksum);
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  tmp1 = (torq << 5) | id;
  tmp2 = 120;                  // position2
  checksum = (tmp1 ^ tmp2) & 0x7f;
  Serial.write(0xff);
  Serial.write(tmp1);
  Serial.write(tmp2);
  Serial.write(checksum);
  delay(1000);               // wait for a second
}
--------------------------------------------------------------
SOURCE FROM
http://blog.daum.net/r0b0t/12725810Hi
here a sam3 servo with arduino UNO
At 1-second intervals SAM3 back and forth between the position values of 20 and 120.
Realistically UNO board power simply turning the servo one I use works fine.
Lines connect the UNO R3 connection has been so from the board.
VCC of 5V ~ SAM3
TX (DIGITAL 1 time) ~ SAM3 of RX
RX (DIGITAL 2 times) SAM3 of TX
GND GND ~ SAM3
/*
  Blink & SAM Control
  Turns on an LED and changes a SAM position on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */
 
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
// for SAM control
int id;        // SAM id
int torq;      // torque level(0:max, 4:min)
int checksum;  // protocol checksum
int tmp1, tmp2;      // temporary byte
// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
  // start serial port at 115200 bps:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  id = 0;
  torq = 2;
}
// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  tmp1 = (torq << 5) | id;
  tmp2 = 20;                  // position1
  checksum = (tmp1 ^ tmp2) & 0x7f;
  Serial.write(0xff);
  Serial.write(tmp1);
  Serial.write(tmp2);
  Serial.write(checksum);
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  tmp1 = (torq << 5) | id;
  tmp2 = 120;                  // position2
  checksum = (tmp1 ^ tmp2) & 0x7f;
  Serial.write(0xff);
  Serial.write(tmp1);
  Serial.write(tmp2);
  Serial.write(checksum);
  delay(1000);               // wait for a second
}
--------------------------------------------------------------
SOURCE FROM
http://blog.daum.net/r0b0t/12725810