I was just amazed that AI wrote anything remotely useful. The first iteration assumed 50Hz. The 2nd iteration based on 250Hz used the following to assign the pulse widths:
Then used the write function with the duty cycle. I haven't analyzed it any depth.
Edit:
The 2nd iteration ChatGPT used the ESP32Servo Library which is essentially a wrapper for the ledc functions for Arduino from Espressif. The AI code probably could have be written or modified to explicitly set the frequency at 250Hz.
Code:
dutyCycle = map(flightControllerSignal, 1000, 2000, 0, 180); // Mapping to servo position
Then used the write function with the duty cycle. I haven't analyzed it any depth.
Edit:
The 2nd iteration ChatGPT used the ESP32Servo Library which is essentially a wrapper for the ledc functions for Arduino from Espressif. The AI code probably could have be written or modified to explicitly set the frequency at 250Hz.
Last edited: