Basic Library
Digital I/O
Analog I/O
Advanced I/O
Time
Math
Trigonometry
Random Numbers
Bits and Bytes
Interrupts
Serial Comm.
Standard Library
Ethernet
Servo Motor
Stepping Motor
Character LCD
SPI
I2C (Wire)
SD Card
SD (File Operations)
Periodic Operation
Clock (RTC)
PPG (Pulse Generator)
WiFiEsp
ICS (Serial Servo)
FreeRTOS Tips
ICS (Serial Servo)
This library ported BizanNishimura's ICS library for GR-ROSE. You can easily control the KRS series serial servo made by Kondo Kagaku. Please refer to the GitHub README for the API specification. To use, specify #include <ICS.h>
. Only sample programs are listed
Sample Program
This sample acquires the position while rotating the ID0 and ID1 servos connected to Serial1. It is synchronous control.
#include <Arduino.h>
#include <ICS.h>
IcsController ICS(Serial1);
IcsServo servo1;
IcsServo servo2;
void setup() {
Serial.begin(115200);
ICS.begin();
servo1.attach(ICS, 0x00);
servo2.attach(ICS, 0x01);
servo1.setPosition(7500-4000);
servo2.setPosition(7500+4000);
delay(1000);
}
void loop() {
for(int position=-4000; position<=4000; position+=100){
Serial.print(position); Serial.print("\t");
Serial.print(servo1.setPosition(7500+position)); Serial.print("\t");
Serial.print(servo2.setPosition(7500-position)); Serial.print("\n");
delay(20);
}
for(int position=-4000; position<=4000; position+=100){
Serial.print(position); Serial.print("\t");
Serial.print(servo1.setPosition(7500-position)); Serial.print("\t");
Serial.print(servo2.setPosition(7500+position)); Serial.print("\n");
delay(20);
}
}
This sample acquires the position while rotating the ID0 and ID1 servos connected to Serial1. It is asynchronous control.
#include <Arduino.h>
#include <ICS.h>
IcsController ICS(Serial1);
IcsServo servo1;
IcsServo servo2;
void setup() {
Serial.begin(115200);
ICS.begin();
servo1.attach(ICS, 0x00);
servo2.attach(ICS, 0x01);
servo1.setPosition(7500-4000);
servo2.setPosition(7500+4000);
delay(1000);
}
void loop() {
for(int position=-4000; position<=4000; position+=100){
servo1.requestPosition(7500+position);
servo2.requestPosition(7500-position);
while(!ICS.isReady())
{
ICS.loop();
; // Do any other process while communicating!
}
Serial.print(position); Serial.print("\t");
Serial.print(servo1.position); Serial.print("\t");
Serial.print(servo2.position); Serial.print("\n");
delay(20);
}
for(int position=-4000; position<=4000; position+=100){
servo1.requestPosition(7500-position);
servo2.requestPosition(7500+position);
while(!ICS.isReady())
{
ICS.loop();
; // Do any other process while communicating!
}
Serial.print(position); Serial.print("\t");
Serial.print(servo1.position); Serial.print("\t");
Serial.print(servo2.position); Serial.print("\n");
delay(20);
}
}