Тёмный

Arduino Tutorial 31: Using Servo in a Simple Project 

Paul McWhorter
Подписаться 385 тыс.
Просмотров 140 тыс.
50% 1

Опубликовано:

 

17 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 857   
@drsmith3411
@drsmith3411 4 года назад
The "math" part is really important. Keep showing it!
@AppieBing
@AppieBing 4 года назад
yeah
@Anonymous-yy5qr
@Anonymous-yy5qr 3 года назад
Yes
@shabiiturk7723
@shabiiturk7723 3 года назад
@@jurgenbaert8197 Yes, Same here
@jerrypeng8215
@jerrypeng8215 2 года назад
Easy math but it works perfectly
@RD_royale
@RD_royale Год назад
the most important
@richthofen9592
@richthofen9592 6 месяцев назад
Hello, Mr. Mcwhorter! I just wanted to tell you that in my entire life I´ve never got excited when someone tell me "This is the homework/assigment for today" but you are the first person in all the world which make it happen. After just some minutes I did the "homework" before watching this video and I just got a lot of fun doing it. I even tricked my dad make him think that I was controlling the servo motor rotating the lamp that I have in my desk before telling him that it was the light produced by the lamp which made it move and the angulation of the lamp made the photoresistor get more or less light (which to the servo was translated to rotation degrees) depending of the rotation. Thank you! Mr. McWhorter. I could say that these are the best videos in all youtube.
@karlgross877
@karlgross877 4 года назад
I did the math and I also added "if" statements after calculating the angle so that it would for sure stay within the range of my servo (15 to 165 degrees) in case the lightVal was higher or lower than my x values I used to find the slope.
@Rebius
@Rebius 3 года назад
me too :)
@terminatorpg1067
@terminatorpg1067 3 года назад
Same :)
@venkateshdeshmukh4605
@venkateshdeshmukh4605 2 года назад
Same here(❁´◡`❁)
@rizamavictor5852
@rizamavictor5852 2 года назад
Me too :)
@MixwellSidechains
@MixwellSidechains Год назад
Me too
@GeoGebweiler
@GeoGebweiler 4 года назад
Hello Paul. I did the assignment and it works. I'm so happy and proud about it. Thank You for Your lessons. Three weeks ago I did not know anything about the Arduino and now I develop to a little expert. You are a great teacher and I am really happy that I have found these tutorial on RU-vid. Please keep on with this series (y)
@bearpapa1606
@bearpapa1606 3 года назад
I'm a bit proud of myself. I was able to not only finish the assignment, but I also wrote a code that set up the min~max photoresistor value by itself depending on the light level. whenever the code detects a smaller min value or larger max value, it will rewrite the minmax photoresistor value. being able to start utilizing the knowledge that I learnt from your previous tutorial feels really great. can't wait to finish all the tutorial.
@paulmcwhorter
@paulmcwhorter 3 года назад
Great idea.
@simontopley4771
@simontopley4771 10 месяцев назад
Any chance of sharing the solution to this please?
@charlielowell4077
@charlielowell4077 2 года назад
I did the assignment too. I can't begin to tell you how much I really appreciate you doing this to help us all learn. I'm an old guy and retired recently and i'm a 2nd time watcher of your Arduino videos. I started out about 7 or so years ago with Arduinos and learned a great deal from all of your older series. I got away from microcontrollers and microcomputers while I pursued 3d printing and laser engraving for a few years. My electronics bench has been calling me for the last few months so, when I needed a refresher, I knew to look back to you and I'm very pleased that you've got a new series! That said, I cheated a little on the assignment. I didn't forget everything I learned from my Arduino past. I remembered the "map" function and mapped the analog read from the LDR to the values of my servo's range (senseVal= map(analogRead(sensePin),0,1023,0,175);). The sketch works great and I owe it to you for being able to get me back into the coding saddle! I see you also have a new Python series too!. I'm going to get into that one soon and I know that I'll benefit from both of these great video sets. YOU ROCK! Thanks again!
@tobinsexton6246
@tobinsexton6246 3 года назад
I've been following this series since lesson one, and I have never been so engaged in doing homework! Half the time I make my code more complicated than it needs to be, and have a good chuckle when you show how easy it is. This one was actually pretty easy in relation to the button switch. I appreciate the need to brush up on my algebra, as it has been far too long! Thank you for your time and knowledge!
@reinodupreez264
@reinodupreez264 22 дня назад
Hi Mr Paul McWhortwer for the first time i got the project to work by myself had to go back to previous projects and notes to get it right!!!! Haven't felt so proud of myself in a very long time since i was declared medically and mentally unfit for duty as an electrician this hit me hard my mental health has been a uphill battle. Today was a major accomplishment for me THANK YOU FOR THAT!!!!!! did not watch this video jet so very exited to see if there is another way...
@autocrosser10
@autocrosser10 8 месяцев назад
I got this one working prior watching any of lesson 31. The code was easily created by referencing a few other lessons. The math is pretty easy at this point. No complaints from me. Enjoyable lesson, seeing all of the previous lessons come together is very rewarding.
@adamcurtice3584
@adamcurtice3584 2 года назад
Once again I got my homework done without cheating. My math was a bit crude but I referred to some of the older projects and got it all to go. the arm swings right as the light goes out and left as it gets brighter. Mission accomplished. Another satisfied customer. :)
@corneliuschamberlainmarcou6127
Hello Paul. I did the assignment and I also added an if statement to print out the weather based on the angle value. thanks very much for your time. 💯
@raultrevino8576
@raultrevino8576 5 лет назад
This is amazing man, im 2 years in to my mechatronics engenieering major here in Mexico and this videos help me to rembeber the basics! Thanks a lot!
@giftmumba6859
@giftmumba6859 3 года назад
AM GLAD WE ARE BOTH MECHATRONICS ENGINEERS WATCHING THESE VIDS...
@rawadhasan9111
@rawadhasan9111 3 года назад
I did the math by myself. I had to fix it after watching because I switched light with dark weather. I really love the fact that you explain the math and science behind engineering. It makes my education feel useful. Thanks Paul!
@paulmcwhorter
@paulmcwhorter 3 года назад
Great job!
@allengerhard9513
@allengerhard9513 5 месяцев назад
I did the home work assignment. I'm happy to say i got working. Im patting myself on the back.( but i did have to go back to see certain things make sure i was correct) so far this arduino tutorial is great. Im 4 years later and almost 40years old still learning new things. This is awesome. Thank you for what you did for us. Sry i dont comment very often but i felt i needed to this time.
@paulmcwhorter
@paulmcwhorter 5 месяцев назад
Great job!
@michaeldalfonzo3912
@michaeldalfonzo3912 2 года назад
I did build the project and coded it to get it to work. I'm not good at math, so I used a series of if loops to set the angle for the servo. Worked just fine. Replaced the if statements with the calculation and of course it worked. Really enjoying these lessons.
@dougweaver8773
@dougweaver8773 Год назад
Hi Paul. I did the homework, drew the curve, derived the equations, wrote the code, and it works! That was a pretty cool example to work through. Thanks again for these lessons!
@paulmcwhorter
@paulmcwhorter Год назад
Fantastic!
@zainharabeh121
@zainharabeh121 Год назад
I did it by my self because of your good teaching and this is my code ; #include Servo myServo; int servoPin=9; int PRPin=A0; int servoPos; int PRVal; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(PRPin,INPUT); myServo.attach(servoPin); } void loop() { // put your main code here, to run repeatedly: PRVal=analogRead(PRPin); servoPos=(180./1023.)*PRVal; Serial.print(" servoPos = "); Serial.print(servoPos); Serial.print(" PRVal = "); Serial.println(PRVal); if (PRVal==PRVal) { myServo.write(servoPos); } if (PRVal==PRVal) { myServo.write(servoPos); } }
@dougbrubacher5198
@dougbrubacher5198 3 года назад
I did the homework (and the math) and it works!...even got an "oooo, ahhhh, from my son in systems design engineering! Used a potentiometer in place of the 5000 ohm fixed resistor so I can adjust the sensitivity to light / darkness. Thanks for another great lesson.
@jaydusterhoff2795
@jaydusterhoff2795 2 года назад
I was able to do the assignment on my own, with a little review from my notes. I realize you are now done with the video series but I am glad you don’t listen to the complainers and keep showing the math and being in depth with your explanations. Very helpful. I was telling my dad about your videos and he made a good point. He said some people are really smart but can’t teach. You sir are very smart and do a wonderful job teaching. Thank you for sharing your knowledge.
@paulmcwhorter
@paulmcwhorter 2 года назад
Great job!
@MarvPerk3
@MarvPerk3 3 года назад
Paul, I did this on my own successfully! I also decided to add an RGB LED (from what I learned in that lesson) so the RGB would glow brighter as the room got darker... aka almost a practical application! The very great news is that I had to do 2 different slope calculations, one for the servo and one for the RGB... and I did it, thanks to your excellent teaching! I don't think I can upload a photo, but I did create a little dial face to go on the servo, and did the ping pong ball on the RGB... so I'm very proud of the result. Adding a servo really got me going! Just as much fun to then watch you do it and see that I did it acceptably!
@carlcallenburg7898
@carlcallenburg7898 2 года назад
I help students with math and at one point I was a teacher. I always get /got the question, "Why Do We Need To Learn This Stuff?" I always agree with the student asking because it is a fair question. I would like to share your lesson with the next student to ask me. You answer the question. Why? ... So we can do things like this!! Thank You Keep it coming ....
@danielhedger6060
@danielhedger6060 4 года назад
Did this on my own and got it right. Math is good, necessary, and important. Thank you for explaining the math behind these projects Mr. McWhorter.
@richardjenkins8728
@richardjenkins8728 2 года назад
I did the homework :) Worked out great, put IF statements to limit the servo no less than 10, and no higher than 170. Thank You for your wonderful tutorials!!!!!!!!!!!
@steviekiss3609
@steviekiss3609 7 месяцев назад
I am happy to say that, thanks to your wonderful tutorials and teaching style, I completed the assignment by my self! And it worked on my first try! Thank you so much for having this high quality and accessible technology education available to students.
@paulmcwhorter
@paulmcwhorter 7 месяцев назад
Wonderful!
@noway9610
@noway9610 4 года назад
wow first time in YEARS i am not afraid or discouraged to tackle math and it make sense! i have always been an "I hate math" kind of guy but here we are making it practical and it is changing my opinion. thank you
@melvinsajith4448
@melvinsajith4448 4 года назад
I did the assignment and it works. I using if statements. Thank You for Your lessons. you are a great teacher and I have never attended a course like these. I love it.
@nerdape7314
@nerdape7314 3 года назад
"You see why I was in engineering and not in Art class" SirPaulCleverness = analogWrite(hisIQ, 1023);
@jamesunsworth00
@jamesunsworth00 4 месяца назад
You are doing such a service!! Thank you so much for being such a wonderful teacher. Your style of teaching is perfect for me; the way you explain not only what, but how and why, the way you repeat important points and even important points from previous videos. Really helps to job my memory. I always do the homework and I love doing it, it works out for me 95% of the time but that toggle switch a few episode back had me struggling. You sir have a gift for teaching
@misterdecaro
@misterdecaro 2 года назад
I enjoyed this assignment! I tried the servo code then copied and added it to the light detector circuit that sets the red and green LEDs and buzzes with the change in light condition.... My favourite part was determining the equation of the required angle with respect to the read value of the light resistance.
@oldcrazyeye6482
@oldcrazyeye6482 3 года назад
i did the assignment. it works!!!! i probably didn't do it the way you would have but i'm proud that i actually made it work.
@scottcassidy8471
@scottcassidy8471 3 года назад
Did it! I couldn't follow the math (it had been too long since learning it in school) back in lesson 25ish, so I took a day to go through Khan Academy's linear algebra lessons and I'm glad I did. The math is so useful and actually makes these projects possible.
@paulmcwhorter
@paulmcwhorter 3 года назад
Great job!
@thunderbolt8582
@thunderbolt8582 5 лет назад
I am very experienced in using servos with Arduino controls. I think you did a great job explaining the math and placing it into the code. I understand the use of the kit servo and using the Arduino to power it. However, my experience is that servos typically can be troublesome when using the 5v Arduino power source. So I just want to mention that in general, the best practice is to use a separate 5 volt supply for the servo. If people follow this tutorial and try to use more power hungry servos, they will run into problems. So I think you did a great job on the tutorial and you might want to consider a lesson using a power hungry servo and show how to connect a separate voltage source. Again, nice work!!!
@simontopley4771
@simontopley4771 10 месяцев назад
Paul did say this at the very beginning, our kit servos are only cheap learning tools.
@whilson8857
@whilson8857 3 года назад
i did it like that: angle = lightVal/5.5; It works almost the same way. Paul, your lessons are amazing. You are a great teacher!
@dannycollins5698
@dannycollins5698 Год назад
I love mathematics. I love computers. This series is wonderful. I want to add that engineering mindset. I'm starting to love the physical computing/robotics side. Controllers-->Actuators-->Environment-->Sensors--Controllers-->etc. This loop is great to think about. Thank you!
@pathvalleyrailroad9277
@pathvalleyrailroad9277 2 года назад
I did the math a bit differently. I had light values between 0 and 780, so at first I used 180/780*lightVal and I got 0 degrees at light val 0 and 180 degrees at light val 780. To reverse it I used (-180/780)*lightVal+180 and that worked just fine. I am really enjoying this series, thanks for making it!
@EdwardRLyons
@EdwardRLyons 3 года назад
I commented on the previous video that I did the homework, so before getting to this video. The maths is very straightforward once you've practiced it a few times. The more projects that depend on doing it, the easier it becomes. It's far easier than working out the more abstract logic that needs to be applied in coding. That's where I struggle! Thank you for this excellent series! I've learned far more coding and building simple circuits in the past two or three weeks than in all my previous efforts in either! On to the next lessons!
@ricardosanchez1638
@ricardosanchez1638 4 года назад
I did it by using information from Tutorial 26. Most of the information is there. I was really interested because I am working on a project that will include a mechanism for tracking the sun for a solar panel robotic system. Loved the Tutorial! Thank you very much Sir!
@LeonJakub
@LeonJakub 3 года назад
I did the math (following a refresher on linear equations, as I haven't done them for 35 years!). Project worked great!
@robertparker5369
@robertparker5369 5 лет назад
Great job Paul. Did the homework and the math and enjoyed it. Even put endpoints in [if (angle>180){angle=180;} ] , etc. Need more homework to keep us busy through the week!
@loptica62
@loptica62 5 лет назад
what you (we) actually need is more ideas for use....
@higuy2k
@higuy2k 4 года назад
Good idea on the endpoints, I did the same in my code. Matt
@paulbrouyere1735
@paulbrouyere1735 4 года назад
Hallo Paul, you are a great teacher. I was sitting next to a programmer the end of the ‘90’s. We were programming 8086 technology under DOS and Assembler. Love your videos, always learning again too. Thank you, you explain really well, and it doesn’t take long before you correct yourself. Great!
@klmyself
@klmyself Год назад
Paul, I had solved this a little differently; I used light range in my room (near 0 to 800) for the evaluation angle = (lightVal/800)*180.; . I reversed connections (llight sensor to ground, resister to 5 volts. That gave the same result as the negative slope calculation. I added the If limitations so as the keep to the 180 deg limit of the servo. Thanks for your tutorials, I'm learning something.
@yolandanelson31
@yolandanelson31 4 года назад
I had to do the math with you because I didn't do the HW correctly. I only made my servo do sunny and dark. I didn't pay attention to the ending of the last lesson. I will do better lol and pay more attention to you near the end, I just get so excited that what we did during the tutorial worked. Keep doing the math, the electrical diagrams, and everything else that shows us the how and the why!
@thethubbedone
@thethubbedone 4 года назад
I coded this and had it working prior to watching, and I added variables for the servo's min and max angles, as well as the min and max light readings, then made the arduino do the math for me. using this line Servo_Angle=(Position_Val_Max/Light_Val_Max)*Light_Val; Thanks again for shooting these videos
@thefierceninja2557
@thefierceninja2557 2 года назад
I also did the math with a limit on how far it can go, works perfectly. keep making amazing lessons!
@kevindegoede9144
@kevindegoede9144 4 года назад
I have really enjoyed the progression from dimmable LEDS to moving the servo based on light intensity. What I have found informative is the development of a program. Apart from trouble shooting testing each section and then going on to the next has made a big difference to my designing my own programs. Thanks for step by step tuition. I am learning every time. Boom! My projects are starting to work with far less frustration.
@xtrimekiller5877
@xtrimekiller5877 4 года назад
I had to follow along with you as I struggle with the math on my own , thanks for teaching me Mr McWhorter !
@erenknl
@erenknl 9 месяцев назад
Thank you so much Paul, I did the homework and I'm so happy with that. Keep going what you're doing, your videos are so helpful for me!
@markloyd8616
@markloyd8616 4 года назад
I did the math based on the previous lessons and it worked great! One thing: when I hooked up my circuit, I wired it so that the +5v goes to the fixed resistor first, then grounded the photoresistor. This gives you a positive slope and makes the math easier.
@kenmeyer100
@kenmeyer100 3 года назад
After I left the delay statements out, the movements were very smooth and it was fun to watch as I moved my hand around the photoresistor like a conductor
@tretty07
@tretty07 3 года назад
Absolutely loving the series, I did the assignment and it worked perfectly, took me a little while to figure the math right but eventually got there. #include int lightR = A0; int lightValue; int dt = 500; int servoPin=3; int servoPos=0; Servo myServo; void setup() { // put your setup code here, to run once: Serial.begin(115200); pinMode(lightR, INPUT); myServo.attach(servoPin); } void loop() { // put your main code here, to run repeatedly: lightValue=analogRead(lightR); Serial.println(lightValue); servoPos=(180./260.)*lightValue - (40.*180./260.)-27.6; myServo.write(servoPos); }
@larrywu9207
@larrywu9207 11 месяцев назад
Hey Paul! My entire class is using your tutorials to learn arduino and we love it! We’ve learn so much and the math is so helpful❤❤
@paulmcwhorter
@paulmcwhorter 11 месяцев назад
Nice work!
@Antivirus-uk3rx
@Antivirus-uk3rx Год назад
This one is custom built to your room, "the math" is important for this and i did it with ya! Starting to feel like im getting somewhere with my arduino!
@tonyperry6702
@tonyperry6702 4 года назад
the homework was a success. servo was responding to available light quite nicely. thank you for all of your hard work putting these videos together.
@StefanEckhardt-y6r
@StefanEckhardt-y6r Год назад
Hi Paul, I did the math....and I did it on my own! First time in my life I understood how to use the math....and it makes fun! Thank you so much! Having a lot of fun with your excercises!
@ralphmarks2727
@ralphmarks2727 2 года назад
started writing out the math, over and over. I don't learn as fast as I should, making a poster of slope formula! Thanks you so much! Hope you are finding God's blessings in Africa.
@hasan-motam
@hasan-motam Год назад
Thanks Paul. I did the assignment on my own. Took me a while to figure out how to connect both the photoresistor and the servo to the 5V power supply.
@geralddrake4617
@geralddrake4617 4 года назад
Yes, I did the math ahead of lesson 31 and I got my servo working with the photo cell light value. Fun project. I love how you apply math principles to programing for that is the real world.
@gregcosner-p2g
@gregcosner-p2g 9 месяцев назад
I did the homework. It worked. I used a positive slope referencing lesson 26. My math is a little rusty, but thanks for explaining it so well.
@JohnyRalte
@JohnyRalte 3 года назад
Sir, I just revisited lesson 30 and 31, and realize that you didn't use pinMode for Servo control pin in lesson 30, but it still worked fine. And then, you used pinMode for Servo control pin in lesson 31, and again it worked. I'm a bit confused on whether declaring pinMode is compulsory or not, for a Servo motor control pin. Thank you. Great video as always.
@shatterism3329
@shatterism3329 Год назад
Hello Paul, I did the homework by myself using what I have learned so far on your past videos. I'm a month away before going to college. I hope the professors teach the same way as you do.
@paulmcwhorter
@paulmcwhorter Год назад
Fantastic!
@mohdarshath8992
@mohdarshath8992 Год назад
Did it with ease. Finished the code in 10 lines. Thanks Paul
@yasins8713
@yasins8713 4 года назад
i did not shut the vid when u started doing math :-) . why your servo motor is not moving smoothly because there is a delay, if there is no delay the servo moves smoothly (i am talking about 36:23). thank you for this awesome tutorial and i am looking forward for the next vid
@ibrahimtijjani8331
@ibrahimtijjani8331 2 года назад
Hello Paul, you are indeed great Teacher since when I started following your videos here, I've been improving day by day, I've done my assignment but different way I used two if statement and it works
@paulmcwhorter
@paulmcwhorter 2 года назад
Great job!
@BlueDeeVo
@BlueDeeVo 4 года назад
Paul I've been watching this whole series from the beginning and haven't commented yet but I had to comment this time because I was so proud that I was able to do the math and the homework assignment. Thank you!
@vidhanmaheshwari2082
@vidhanmaheshwari2082 5 лет назад
Sir I did the math and completed the project but I had some problem in my servo ... I ordered it and it came today and made the project just an hour before and here you are...Thanks.
@jadersoares3659
@jadersoares3659 11 месяцев назад
Dear Professor Paul, I managed to do the homework, I had some time without being able to study due to everyday tasks, but I am committed to learning, God bless you.
@paulmcwhorter
@paulmcwhorter 11 месяцев назад
Excellent!
@m00se22
@m00se22 4 года назад
I did the math quickly in Excel to save some time. Works like a charm, and I can see it being applied in multiple uses.
@zada.2008
@zada.2008 2 года назад
I did the homework! I really enjoyed doing the math and seeing everything work out! You're really helping me out with being able to overcome obstacles while trying to solve these problems.
@PedroLuis-yp9ed
@PedroLuis-yp9ed 3 года назад
The math was really discouraging but learning to do it, plugging it into the code, and seeing something physically happen because of it just makes it all magical like lol. I was a genius at math in high school and threw it all out my brain because the teachers always just told us to shut up and learn it without giving us any applicable scenarios. Then college I learn about this, and they omitted the math. Years and 30K waisted on college for nothing, and here a teacher putting it all together for $0....I wish in the end it could be your signature on my college diploma. Thanks again for doing this.
@bill6590
@bill6590 3 года назад
OK, I did the homework and made it work correctly. It took a little thinking, a little math, and frustration. But, I did it, and it worked. It helps to do homework after the subject matter has been discussed. That way you can use it to learn something. Instead of in one tutorial, trying to solve a problem without being given all of the necessary command information. This approach works much better. Plus, you get to see the answers in the very next video.
@IanReeves78
@IanReeves78 3 года назад
Thank you for another great session Paul. I did on my own, using the math, and then added a RGB LED to display green for bright, blue for dull and red for dark. I then used the map command to get the angle. I'm enjoying your videos.Ian.
@haastrupadebayoibukun6817
@haastrupadebayoibukun6817 2 года назад
I was able to do my assignment. I used a range of 10-800 for my sensor, and 0-180 for the servo which I made my dependent variable, so I got my mathematical relationship through this. To eliminate negative and above 180 value, I used IF conditional statement of which I set the likelihood of negative value to 0 for the servo and the above 180 to 180. I got my my result.
@brikozub
@brikozub Год назад
I rewrote what we made in the last lesson. The servo would start at 0 and increment by 1, until it reached 180. Then, the servo would do the same in reverse. When it reached 0 again, I asked the user for a new increment, before doing the same process, using the provided increment. I did that before you gave the homework assignment, so I decided to let the increment level be decided by the level of light. If it's bright, the servo increments quickly through the cycle, and if it's darker, slower. The more complicated the circuits are, the more exciting the programming gets, because there's so much more room for exploration and finding different solutions to the same problems.
@paulmcwhorter
@paulmcwhorter Год назад
Excellent!
@rukidding7588
@rukidding7588 4 года назад
I really do appreciate Paul showing all the high school math. Some people never got it in high school, and many others have forgotten it. It is important in order to understand the principles behind the projects. That said, no, I didn't do the math. Years of doing this sort of thing has given me a kind of intuitive feel for it. So, like Paul, I first got my light sensor readings (100 - 1000). Then, realizing I have to map those values over only 180 degrees of servo movement, I calculated (1000 - 100)/180, which VERY conveniently comes out to 5. So, that told me I have to divide my light sensor readings by 5. I decided I wouldn't bother with floating point values. I figured integers would do for this project. One thing I didn't like was the fact that the servo goes counter-clockwise as the angle value increases. This would mean the pointer would point completely left in sunlight. I like low on the left and high on the right, so I calculated the angle and then subtracted it from 180. This made it so the angle gets smaller & smaller as it gets brighter. Works like a charm. My command was: sensorVal=180-(analogRead(sensorPin)/5); I then checked to see if sensorVal is greater than 180 or less than 0. If so, I set it to 180 or 0 as appropriate. This was a fun project. Thanks Paul.
@Ethanstonge
@Ethanstonge Год назад
i did the homework in like 10 mins thank you for explaining it the way you did and also you liked my comment from the last vid i watched adn that made my day. you actually care about your audience and it rocks
@Russell900
@Russell900 3 года назад
I am loving this videos, I honestly feel like I'm actually learning how to do what I want with the Arduino and not just following along, I did the math and got the photo resistor working with the servo before watching this video. Thanks for all your hard work, I'm very much enjoying getting a deeper understanding of how the code is working through the math.
@paulmcwhorter
@paulmcwhorter 3 года назад
You can do it!
@kirstinlee6838
@kirstinlee6838 9 месяцев назад
This was a great project! I was able to set up my board before you showed the video. I really appreciate the math because it helps me understand how it works. Thank you so much!
@eladioh3858
@eladioh3858 3 года назад
I did the homework !!! had to go back to remember a few things, it paid of. Thank you for all the hard work that you put in to your Videos.
@kageshirou
@kageshirou 3 года назад
I was able to figure this out based on the math you taught me in previous lessons! Many thanks!
@chrisgosling5408
@chrisgosling5408 2 года назад
I like the addition of the maths, no pun intended. it helps to build the picture. In engineering it is important to understand the problem. You solve the problem and action this using the code!
@blakerogers2608
@blakerogers2608 4 года назад
Did the homework before watching this video. I had to troubleshoot a bit as I kept using the wrong coding to write the position to the servo, but finally figured it out! Thank you for the great lessons!
@arunhuddar
@arunhuddar 3 года назад
For me the key was to get the wiring right and then the math and then get the programming. Was able to do it. Feel good. Thanks Paul for putting us through the test.
@123selkirk
@123selkirk 4 года назад
Did my homework from lesson 30. Figured it out with the lessons before. Thanks for giving great lessons. Was good figuring the math behind it as well. Cheated and used the serial monitor to make sure my math was correct before adding the servo to the mix. Thanks for doing these videos. Confidence is improving.
@erikburman530
@erikburman530 2 года назад
I am math challenged so I really appreciate that you have especially emphasized the line-slope equation for the last several sessions. I have made it a point to do the assignments ahead of time and work through the line equations prior to your explanation. I think it has finally soaked into my brain. Sure it would be simple enough to use the map() function but the Aha! moments are so much more rewarding. I am surprised that an engineer like yourself didn't go into much detail about how servos work. But I guess there's only so much information you can pack into all this.
@gonnieben-tal8186
@gonnieben-tal8186 7 месяцев назад
Thanks for making this video and for sharing it with us! I think that we should include a couple of "if statements" in case the angle becomes greater than 180 or less than 0 to make sure we keep the values we're inputting into the servo within their allowed range.
@426F6F
@426F6F Год назад
I did my math the opposite way so that the brightest value displayed ~180 degrees and the darkest was ~0 degrees. It gave me a positive linear slope. But I figured while I was doing the math that I could just swap the dependent variable in the y points to give a new equation, so that the opposite was the case. It was cool to see you choose the other of the two!
@michaeltue3176
@michaeltue3176 2 года назад
I did the homework, mostly by myself I got the M-slope value but point-slope equation is a bit harder to solve as my algebra is a bit rusty. I used an online slope calculator to help to get the line equation. The programming part was all good. I am doing some more algebra lessons, so soon should get the hang of it too. Thank you for your time making the lessons.
@srduke
@srduke 5 лет назад
I get more satisfaction from working out the equations than just using the mapping function.
@DailyLifeCaption
@DailyLifeCaption 2 года назад
Hi Paul, I did assignment before watching this videos to verify if my maths calculation is correct. it's all thanks to knowledge that i have learnt from you on previous tutorial . I strongly agreed that explaining how's the maths work is really important as it let us understand how to find the ratio of y-axis to x-axis .Love your tutorial as it really detailed and funny . I would also like to suggest to put Formula , Minimum and Maximum value for servo angle and photo-resistance in the code as it would ease to review and check the codes and less mathematical errors. Anyway i do really wish if you could continue with this Arduino tutorial series. Stay healthy. Below are my arduino codes: #include int servoPin = 6; float servoPos = 0; Servo myServo; int waittime = 500; //x1,y1 float minLightres = 50; //x1 float minAngle = 0; //y1 //x2,y2 float maxLightres = 885; //x2 float maxAngle = 180; //y2 float gradient; int lightPen = A0; int lightVal; void setup() { // put your setup code here, to run once: Serial.begin(9600); myServo.attach(servoPin); pinMode(lightPen, INPUT); } void loop() { // put your main code here, to run repeatedly: lightVal = analogRead(lightPen); Serial.print("lightVal :"); Serial.println(lightVal); //Formula : (y2-y1) / (x2-x1) gradient = (maxAngle - minAngle) / (maxLightres - minLightres); servoPos = (gradient * (lightVal - minLightres)) + minAngle; Serial.print("servoPos :"); Serial.println(servoPos); myServo.write(servoPos); delay(waittime); }
@yusufguler1662
@yusufguler1662 4 года назад
I did the homework and please don't stop your lessons they are amazing
@Александр-р3э3м
@Александр-р3э3м 4 года назад
I did it on my own, but in a little bit different way: i had higher value on the left side, increasing the angle, and the lower value on the right one, decreasing the angle of servo position. But it worked!) As i saw way you do it (lower value - higher angle; higher value - lower angle), i have done some math also and done it in the way you have. And thank you for your great lessons, with deep explanation and practicing math! They are just gold!
@supermardy1
@supermardy1 2 года назад
Thank you Mr Paul my math for this one turned out different managed to get it to work but after watching your example. It made more sense. Thank you.
@georgeshaiffer2246
@georgeshaiffer2246 3 года назад
Paul, Please do not reduce or eliminate the math content. Although I have what I consider a good math foundation it is refreshing and informative for me to see the application and a review doesn't hurt. A valuable part of your presentations. Many younger users of your Tutorials will learn and use some of the math long before their school includes in their classes. They will feel very good about themselves when this happens.
@Ameer5CT
@Ameer5CT 3 года назад
I always do the homework and focus on every second of the videos. I really benefit from the course. Thank you very much for all of that but I don't know what to comment so this is my first one here. Maybe there is a lot of people who watching silently like me I hope you read that
@ericroque5813
@ericroque5813 6 месяцев назад
I did a different math. I measured the resistances at both ends and divided it to a number, did the same at the servo's angle from 0 to 180 so each levels of lightVal will match the angle of the servo. I used IF function to "box out" two values so that servo would not go back and forth when light is insufficient to be detected. I would say this is best for light activating circuits when the intensity of light source is constant but if the reference light might change every other day like the daylight, this is inapplicable as you would change the values in your program. Nonetheless, you are awesome Paul. Thank you for this. If you existed on my RU-vid decades ago, I would've created great devices. hahaha
@bryankohn9660
@bryankohn9660 3 года назад
I did the assignment and was successful. Used code from Lesson 25. I made a little card marked Light-Dark with some important looking graduation marks in between. A working light meter!
@dannycollins5698
@dannycollins5698 Год назад
Did the assignment! Because you told me to. You're the teacher, the boss. I am the student. I do what you tell me. 😃 Loved doing the Math.
@Abv1911
@Abv1911 3 года назад
Did it myself but never thought that I would have such a great teacher
@akosslemmer4603
@akosslemmer4603 3 года назад
Homework completed, this one was way easier than the previous two, since there were no "new" logic involved. I'm about to make a "useless box" as a birthday present for my friend, and writing the program now won't be a challenge. Assembling it is another topic, but I'm pretty sure it'll be neat. Thank you again for all these content! :)
@markfuentes3666
@markfuentes3666 4 года назад
Did the math before I watched the video. I got it just like you. This is giving me so many ideas. Thank you very much.
Далее
Eminem НА РУССКОМ💔
00:30
Просмотров 365 тыс.
Fake watermelon by Secret Vlog
00:16
Просмотров 4,6 млн
Why build an entire computer on breadboards?
28:43
Просмотров 3,1 млн
Electronic Basics #25: Servos and how to use them
5:55
Multiple Servo Control with Potentiometers and Arduino
7:59
Arduino Tutorial 14: Dimmable LED Project
29:47
Просмотров 250 тыс.
How to Use Arduino Interrupts The Easy Way
33:28
Просмотров 87 тыс.
Eminem НА РУССКОМ💔
00:30
Просмотров 365 тыс.