help a noob out!! simple button trigger A servo.
help a noob out!! simple button trigger A servo.
Sory this is probably easy to the esp masses all i want to do is trigger a servo for a set time im using a dmx relay so basicaly when closed trigger the esp32 to make the servo close. hope that makes sense
Re: help a noob out!! simple button trigger A servo.
Do you have any code to share?
What coding language?
If you have nothing yet then use online Ai bot and ask it to write you a short program for Arduino IDE or microPython for what you want to do.
DDG gave me this, but probably needs to be modified using some other gpio to monitor for your trigger.
#include <ESP32Servo.h>
Servo myServo; // Create a servo object
const int servoPin = 26; // Pin connected to the servo
const int relayPin = 2; // Pin connected to the DMX relay
void setup() {
myServo.attach(servoPin); // Attach the servo to the pin
pinMode(relayPin, INPUT); // Set relay pin as input
}
void loop() {
if (digitalRead(relayPin) == HIGH) { // Check if relay is closed
myServo.write(90); // Move servo to 90 degrees
delay(2000); // Wait for 2 seconds
myServo.write(0); // Move servo back to 0 degrees
}
}
What coding language?
If you have nothing yet then use online Ai bot and ask it to write you a short program for Arduino IDE or microPython for what you want to do.
DDG gave me this, but probably needs to be modified using some other gpio to monitor for your trigger.
#include <ESP32Servo.h>
Servo myServo; // Create a servo object
const int servoPin = 26; // Pin connected to the servo
const int relayPin = 2; // Pin connected to the DMX relay
void setup() {
myServo.attach(servoPin); // Attach the servo to the pin
pinMode(relayPin, INPUT); // Set relay pin as input
}
void loop() {
if (digitalRead(relayPin) == HIGH) { // Check if relay is closed
myServo.write(90); // Move servo to 90 degrees
delay(2000); // Wait for 2 seconds
myServo.write(0); // Move servo back to 0 degrees
}
}
Who is online
Users browsing this forum: No registered users and 1 guest