servo.ino
Two servos in quadrature draw a caterpillar motion: the GIGA core's Servo library handles several timers without conflict. The seed of an arm, gantry or rover.
Hardware required
An Arduino GIGA R1 WiFi (STM32H747, 1DX radio module: Wi-Fi b/g/n + BLE, u.FL antenna included), powered over USB-C. 2 SG90 servos + external 5 V supply ≥ 1 A.
Wiring
Signals on D5 and D6, + to the external supply, grounds common with the GIGA. Never servos on the board 5 V.
How it works
Each Servo object reserves its timer channel; write() places the pulse. The 20 ms step (50 Hz update) is plenty for the mechanics. In the Arduino IDE, « Arduino Zephyr-based Boards » platform, « Arduino Giga R1 » board; fit the u.FL antenna before using the radio, then Upload.
Going further
Four servos for a mini-arm, or position saved to EEPROM at every power-down.
servo.ino
// Deux servos sur D5/D6 — la bibliotheque Servo du core GIGA.
#include <Servo.h>
Servo gauche, droit;
unsigned long precedent = 0;
int phase = 0;
void setup() {
gauche.attach(D5);
droit.attach(D6);
Serial.begin(115200);
}
void loop() {
if (millis() - precedent < 20) return;
precedent = millis();
phase = (phase + 2) % 360;
float rad = phase * PI / 180.0f;
gauche.write(90 + (int)(60 * sinf(rad))); // 30..150 degres
droit.write(90 + (int)(60 * cosf(rad))); // en quadrature
if (phase % 90 == 0)
Serial.printf("G=%d D=%d\n", gauche.read(), droit.read());
}