WIP: snapshot before repo migration
This commit is contained in:
33
jxbeye/lib/FTServo/examples/SMS_STS/Ping/Ping.ino
Normal file
33
jxbeye/lib/FTServo/examples/SMS_STS/Ping/Ping.ino
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
Ping指令测试,测试总线上相应ID舵机是否就绪,广播指令只适用于总线只有一个舵机情况
|
||||
*/
|
||||
|
||||
#include <SCServo.h>
|
||||
|
||||
SMS_STS sms_sts;
|
||||
|
||||
int LEDpin = 13;
|
||||
void setup()
|
||||
{
|
||||
pinMode(LEDpin,OUTPUT);
|
||||
digitalWrite(LEDpin, HIGH);
|
||||
Serial.begin(115200);
|
||||
Serial1.begin(1000000);
|
||||
sms_sts.pSerial = &Serial1;
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
int ID = sms_sts.Ping(1);
|
||||
if(!sms_sts.getLastError()){
|
||||
digitalWrite(LEDpin, LOW);
|
||||
Serial.print("Servo ID:");
|
||||
Serial.println(ID, DEC);
|
||||
delay(100);
|
||||
}else{
|
||||
Serial.println("Ping servo ID error!");
|
||||
digitalWrite(LEDpin, HIGH);
|
||||
delay(2000);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user