Can Firefly work with ESP32 instead of Arduino?

I am trying to send firefly_firmata to ESP32 wroom, but it seems like it requires some edits in the code rather than just upgading libraries. However, I am not proficient in code as I am only familiar with writing Grasshopper definitions and just started to learn electronics.
GPT says I should add this to file but I honestly have no idea how to complete it without errors.

#include <ESP32Servo.h>

Servo myServo; // Create servo object

void setup() {

  • myServo.attach(18); // Attach servo on pin 18*
    }

void loop() {

  • for (int pos = 0; pos <= 180; pos += 1) { // Sweep from 0 to 180 degrees*
  •    myServo.write(pos); // Set servo position*
    
  •    delay(15); // Wait for the servo to reach the position*
    
  • }*
  • for (int pos = 180; pos >= 0; pos -= 1) { // Sweep back from 180 to 0 degrees*
  •    myServo.write(pos);*
    
  •    delay(15);*
    
  • }*
    }

Somebody else tried ESP32 with Firefly before? Is this possible?

Played with Firefly back in 2020. Never used its “firmata,” just two components, Open Port and Serial Write, which allowed connection to a two-stepper control board by sending text commands over USB-serial:

Didn’t try to get farther because of big speed limitations. Started using ESP32 a couple years later, and continue to use the Arduino IDE to program it using the same USB-serial connection. A quick search finds many tutorials for controlling hobby servos with ESP32 using the Arduino interface. If you are comfortable programming your ESP32 to parse incoming text on its serial port, and you want to control your servo’s position using GH, just use Firefly to open the serial port and send the position values as text. This old thread might be relevant.

1 Like

Wow, I was overcomplicating things with firmata. Thank you, very helpful