Hello, there. I'm new here and a lover of ESP32. However, I really tried to not create this topic but I just dont know what to do.
The title of this topic explained everything. I did put a servo motor connect to an arduino and it work. When I try with ESP32, this servo just does not move. I've tried some gpio and external font. (Yes, I linked the ground).
Could someone help me? Thanks a lot.
Servo motor (sg90) simply doesnot works with ESP32. But works with Arduino.
-
- Posts: 9730
- Joined: Thu Nov 26, 2015 4:08 am
Re: Servo motor (sg90) simply doesnot works with ESP32. But works with Arduino.
Would help if you could post your hardware setup and code...
Re: Servo motor (sg90) simply doesnot works with ESP32. But works with Arduino.
The code and hardware setup are not a big deal because of basic test, but here they are:
Arduino Code:
Arduino Code:
Arduino Hardware:Code: Select all
// Include the Servo library #include <Servo.h> // Declare the Servo pin int servoPin = 3; // Create a servo object Servo Servo1; void setup() { // We need to attach the servo to the used pin number Servo1.attach(servoPin); } void loop(){ // Make servo go to 0 degrees Servo1.write(0); delay(1000); // Make servo go to 90 degrees Servo1.write(90); delay(1000); // Make servo go to 180 degrees Servo1.write(180); delay(1000); }
ESP32 Code:
ESP32 Hardware:Code: Select all
#include <ESP32Servo.h> Servo myservo; // create servo object to control a servo int servoPin = 13; int pos = 0; // variable to store the servo position void setup() { myservo.attach(servoPin); // attaches the servo on pin 13 to the servo object } void loop() { // Make servo go to 0 degrees myservo.write(0); delay(1000); // Make servo go to 90 degrees myservo.write(90); delay(1000); // Make servo go to 180 degrees myservo.write(180); delay(1000); }
Who is online
Users browsing this forum: No registered users and 40 guests