Files
Micro-Wheeled_leg-Robot/3.Software/libraries/SCServo/examples/SCSCL/Ping/Ping.ino
T
deepseek Bot 324d114386 Add PlatformIO project setup, local libraries, and PCB Gerber files
- Add platformio.ini for ESP32 DevKit (Arduino framework, espressif32 6.10.0)
- Vendor ArduinoJson, MPU6050_tockn, SCServo, Simple_FOC, and WebSockets
  so a fresh clone builds without downloading dependencies
- Add .gitignore rules for PlatformIO/IDE build artifacts
- Add controller PCB Gerber and drill files
2026-10-25 19:15:17 +08:00

41 lines
701 B
Arduino

/*
Ping() to test a servo on the bus is ready.
*/
// the uart used to control servos.
// GPIO 18 - S_RXD, GPIO 19 - S_TXD, as default.
#define S_RXD 18
#define S_TXD 19
#include <SCServo.h>
SCSCL sc;
int TEST_ID = 3;
int LEDpin = 13;
void setup()
{
pinMode(LEDpin,OUTPUT);
digitalWrite(LEDpin, HIGH);
Serial.begin(115200);
Serial1.begin(1000000, SERIAL_8N1, S_RXD, S_TXD);
sc.pSerial = &Serial1;
delay(1000);
}
void loop()
{
int ID = sc.Ping(TEST_ID);
if(ID!=-1){
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);
}
}