Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Confluence
/
Pololu Servo Controller

Pololu Servo Controller

Mar 15, 2017

Mit dem Polulu Servo Controller können bis zu 8 Servos gleichzeitig angesteuert werden. Zusätzlich können die Servos einfach mit einem externen Netzteil gespiesen werden.

Einfaches Protokoll (mit Jumper)

#include <SoftwareSerial.h>
  
// pin 6 is to receive from the controller and does not need to be connected
// pin 7 needs to be connect to the serial data input of the board
SoftwareSerial pololu(6, 7);
  
int pos = 0;
  
void setup() {
  Serial.begin(9600);
  pololu.begin(9600);
}
  
void loop() {
  Serial.println(pos);
  
  // set position for eight servos simultaneously
  for(int i=0; i<8; i++) {
    setPosition(i, pos);
  }
    
  pos++;
  if(pos >= 255) {
    pos = 0;
  }
  
  delay(10);
}
  
void setPosition(int servo, int pos) {
  pololu.write(0xFF); // write synchronization flag
  pololu.write(servo + 8); // write servo number (without +8 == 90°)
  pololu.write(pos); // write position
}

Erweitertes Protokoll (ohne Jumper)

#include <SoftwareSerial.h>
 
// pin 6 is to receive from the controller and does not need to be connected
// pin 7 needs to be connect to the serial data input of the board
SoftwareSerial pololu(6, 7);
 
int pos = 0;
 
void setup() {
  Serial.begin(9600);
  pololu.begin(9600);
}

void loop() {
  Serial.println(pos);
 
  // set position for eight servos simultaneously
  for(int i=0; i<8; i++) {
    setPosition(i, pos);
  }
   
  pos++;
  if(pos >= 255) {
    pos = 0;
  }
 
  delay(10);
}
int setPosition(int servo, int pos) {
  byte data2 = pos & B01111111; // calculate second data byte 
  byte data1 = pos >> 7; // calculate first data byte

  pololu.write(0x80); // write start byte
  pololu.write(0x01); // write device id
  pololu.write(0x04); // write absolute position command
  pololu.write((byte)servo); // write servo number
  pololu.write(data1); // write first data byte
  pololu.write(data2); // write second data byte
}
, multiple selections available,
For you

Electrical Engineering
Results will update as you type.
  • Aesthetic elements in Eagle
  • Actuators and Outputs
  • Aktuatoren (DE)
  • Analog Input
  • Analog Sensors
  • Arduino Grundlagen
  • Arduino Programmieren
  • Arduino und Processing
  • Shift Registers
  • Carvey
  • Capacitors
  • Bread Boards
  • Digitaler Input
  • Digitaler Output
  • Eagle
  • Energy Harvesting
  • H-Bridge
  • I2C (en)
  • Interrupt Service Routine
  • Mosfet Transistor
  • LED
  • PCBs Herstellen
  • Pololu Servo Controller
  • Relays as Switches
  • Pulse Width Modulation
  • RFiD
  • Schrittmotorentreiber
  • SD Karten
  • Signal Filtering
  • Transistors as Switches
  • Widerstand
  • PCB Manufacturing
  • PlatformIO
  • Lynx Smart Motion Servo
  • Electronics Basics (EN)
  • Arduino Basics (en)
  • Arduino Programming (EN)
  • Digital Outputs (en)
  • Digital Input (en)
  • Serial Communication (en)
  • Pulse Width Modulation (en)
  • Resistors (en)
  • Arduino and P5.js
  • Arduino and ml5.js
  • Project box 2021
  • Servo Motors
  • H-Bridge (DE)
  • Networking
  • Bit Shifting
  • C++ (Arduino) Variables
  • Stepper Motor Drivers
  • Interrupt Service Routine (en)
  • Common Arduino Problems
  • Finite State Machine
  • Voltage Regulators
  • Arduino USB HID (Human Interface Devices)

{"serverDuration": 60, "requestCorrelationId": "ba970a3e486140a885928ac6d2af0b12"}