// ST4-ESP32 Pulse Guide Example // Demonstrates hardware-timer pulse guiding with position tracking // // Send via serial (57600 baud): // CONNECT# - connect to mount // PULSE RA+ 500# - pulse RA+ for 500ms // PULSE DEC- 1000# - pulse DEC- for 1 second // POS?# - read current position // STATUS?# - full status report #include ST4Controller controller; ST4Serial st4Serial; void setup() { Serial.begin(115200); Serial.println("ST4 Pulse Guide Example"); controller.begin( ST4_PIN_RA_PLUS, ST4_PIN_RA_MINUS, ST4_PIN_DEC_PLUS, ST4_PIN_DEC_MINUS, ST4_PIN_LED ); st4Serial.begin(controller, Serial); controller.connect(); Serial.println("Ready. Try: PULSE RA+ 500#"); } void loop() { st4Serial.update(); // Print position every 5 seconds while moving static uint32_t lastPrint = 0; if (millis() - lastPrint > 5000) { lastPrint = millis(); if (controller.axisActive(ST4AxisId::RA) || controller.axisActive(ST4AxisId::DECLINATION) || controller.isPulseActive()) { Serial.print("RA: "); Serial.print(controller.position(ST4AxisId::RA), 6); Serial.print(" DEC: "); Serial.println(controller.position(ST4AxisId::DECLINATION), 6); } } }