Arduino Uno R4 WiFi LESSON 22: Control a Servo With Your Arduino

Published 2024-06-20
Pick your Sunfounder kit up so you get the same results I do:

amzn.to/3SciApZ

You can pick up the neat jumper wires I showed in the video here:

amzn.to/3U2vyIe

You guys can help me out over at Patreon, and that will help me keep my gear updated, and help me keep this quality content coming:

www.patreon.com/PaulMcWhorter

In this video I show you how to control a servo using the arduino. We learn how to load libraries, and control the position of the servo. Enjoy!

[Disclosure of Material Connection: I am a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com. ]

#arduinor4wifi
#servo
#tutorial

All Comments (21)
  • @qzorn4440
    Servos and robots are so cool. Thank you Paul.
  • @pdaip9680
    Walmart lawn chair abject failure - in Lesson 22 the servo is using the only 5V pin on the R4 UNO. Now I need to add the potentiometer but as per Lesson 12 that needs a 5V pin as well. Not risking frying my R4 by experimenting, so will have to head for the next lesson to find the answer... great lessons by the way.
  • Good day, I am Engineer. Your series on Arduino has made me a better Engineer. I would appreciate if you could start a series on ESP 32, because you have a unique way of teaching which is very very good. Thanks. Have a nice day. Cheers
  • @LorisHW
    Thanks for the lesson! HW done but I will not make a video since I can no longer link to it here.
  • @charlotteswift
    Hi Paul Here is my homework for lesson 22. It's only 44 seconds long so I hope you (& The Guys) will take the time to watch it even though I can't leave a link.
  • @AshrayJK
    Can u please do arduino lessons on the elegoo 37 sensors kit V2.0 arduino, i wanna learn how to do them and i cant find good tutorials but then i knew who the best tech tutor is. love ur lessons btw
  • @KevalPattani
    Hi, I have watched your past videos on auduino r3, I kinda just want to know that how to make your famous cold coffee.
  • I have SG90 servo motors, they just spin continuously. Don't know if the Sunfounders are any different?
  • Hello... I have a bunch of arduino stuff. I have to buy a new set of arduino's things to follow this course? But i have tinkercad just in case...
  • @KillerGuy
    Isn't it better to power the servo using an external power source?
  • This problem has been solved. Read the reply below. HELP: Last night I was working with R4 and put power in the wrong place. Not only did the R4 stop working but four other Arduinos are failing to load programs after clean compilations. They show that port is grayed out. I think I have destroyed a library. How can I remove both the old Arduino IDE and the new one so that I get a clean set of libraries?
  • I don't have time to post the video before the class on Thursday, but I am posting the code without the servo code. I will finish the circuit over the weekend and post it with the video. Notice that the equation of the line does not go through the (0,0) point but has a negative intercept. That is because the potentiometer subtends an angle of more than 180 degrees. // 23 potServo.txt int potPin= A2; int potVal; int br= 9600; int waitT= 100; int angle; void setup() { // put your setup code here, to run once: pinMode(13, OUTPUT); pinMode(potPin, INPUT); Serial.begin(br); } void loop() { // put your main code here, to run repeatedly: digitalWrite(13, LOW); potVal= analogRead(potPin);delay(waitT); angle= .254*potVal-56.134; // This is the line with a Y intercept Serial.print("potVal: "); Serial.print(potVal); Serial.print(" Angle: "); Serial.println(angle); delay(waitT); }