Arduino Tutorial 38: Using a Tilt Switch Cut Off With a DC Motor

  Рет қаралды 69,536

Paul McWhorter

Paul McWhorter

Күн бұрын

Пікірлер: 414
@coltongerber4498
@coltongerber4498 2 жыл бұрын
I did the homework on the last episode no problem and decided to use the knowledge Ive gained so far afterwards to combine my DC Motor, Servo, and Joystick , X controlling motor speed/direction , Y controlling servo position to point the fan in a desired direction. My longest code so far and was successful right away. Fantastic teaching I can’t thank you enough !
@426F6F
@426F6F Жыл бұрын
Great idea, Colten!
@arseivan
@arseivan 2 жыл бұрын
Great lesson! Here is the code I ended up having before watching the video: void loop() { bool tiltVal = !digitalRead(tiltPin); digitalWrite(directionPin1, HIGH & tiltVal); digitalWrite(directionPin2, LOW & tiltVal); analogWrite(speedPin, mSpeed); }
@LeonJakub
@LeonJakub 4 жыл бұрын
Did the homework! When you see people only viewing for 3 minutes I think you'll find it's people just revisiting sections of tutorials they have watched in entirety previously to help better understand the one they are currently working on. I have certainly done this on multiple occasions!
@Anmol-AK
@Anmol-AK 11 ай бұрын
Completed the homework under 30 minutes on my own. Thanks a lot for your teaching sir
@christophechalons9072
@christophechalons9072 4 жыл бұрын
Did my homeworks, even managed to control speed and direction with a pot and a pushbutton (using the INPUT_PULLUP status given by one of your followers)... I'm so happy that 2 days ago I didn't even know how to use a component... now I just feel like understanding is at hand ! What I like the most is when you explain by physics and math how and why things work in a component. It's so helpfull !
@nickr8747
@nickr8747 5 жыл бұрын
Keep doing these videos. they may not be crazy popular, but you have no idea how much these videos help us.
@tntragan
@tntragan 2 жыл бұрын
Did the homework. I used a while loop instead and it worked quite nicely. Had to take the delays out like you did. I was yelling at you about the analogWrite instead of the digitalWrite. My wife thinks I'm crazy.
@dannycollins5698
@dannycollins5698 Жыл бұрын
Finished the homework before watching this. I used an else statement instead of another if statement. Thank God for you! God bless you sir!
@VegasGuy89183
@VegasGuy89183 Жыл бұрын
I did my homework and had it working prior to watching this episode. Setting the motor speed to zero seemed logical, so that's what I did. The only mod I made was to put the tilt-switch on a couple of male/female wire extensions to make the tip-over testing easier. Thank you for another wonderful lesson. 👍
@kriegschwert
@kriegschwert Жыл бұрын
Haha, putting the tilt switch on extensions was a great idea, thanks!
@caripatd232441
@caripatd232441 4 жыл бұрын
I made it Mr. McWhoter. Great video as always. I will finish this course to the end. So far I haven't had any problem and I've managed to pull out every assignment before see in you doing it. I always watch your videos up until the last second. Thank for your hard work doing these videos.
@sammysam1503
@sammysam1503 4 жыл бұрын
I did this after the previous lesson all on my own! Loving the videos! int speedPin=5; int dir1=4; int dir2=3; int tiltPin=2; int tiltVal=0; int mSpeed=255; void setup() { // put your setup code here, to run once: pinMode(speedPin,OUTPUT); pinMode(dir1,OUTPUT); pinMode(dir2,OUTPUT); pinMode(tiltPin,INPUT); digitalWrite(tiltPin,HIGH); pinMode(buttonPin,INPUT); Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: tiltVal=digitalRead(tiltPin); analogWrite(speedPin,mSpeed); Serial.println(tiltVal); if(tiltVal==1){ digitalWrite(dir1,LOW); digitalWrite(dir2,LOW); analogWrite(speedPin,mSpeed); tiltVal=digitalRead(tiltPin); Serial.println(tiltVal); } if(tiltVal==0){ digitalWrite(dir1,HIGH); digitalWrite(dir2,LOW); analogWrite(speedPin,mSpeed); tiltVal=digitalRead(tiltPin); Serial.println(tiltVal); } }
@katherineclarke4435
@katherineclarke4435 4 жыл бұрын
BOOOOOM!!! Did it all by myself, coded it a slightly different way. Tilt sensor wasn't working at first, narrowed it down to hardware issue through your excellent de-bugging training; moved it away from the columns occupied by L293D and giddy up!!!! Success!
@bleujaegel
@bleujaegel Жыл бұрын
Made it through the homework unscathed. Love the homework assignments!
@MarvPerk3
@MarvPerk3 3 жыл бұрын
Hi, Paul. Did the homework on my own successfully. Since the bread board is so big and I hate to have to tear it down and start over most times, I decided to see if I could combine lessons 35, 36, 37 and 38, both schematic and code, so I could run the whole shmear at once. So, now I have a reversible stepper motor driven by a toggle switch, a DC motor and fan running clockwise (so the air blows out/up from the blades), and both motors stop if the tilt switch goes to 1... with green and red LEDs to indicate when it is normal vs "tilted". I'm sure the battery doesn't love running 2 motors at once, but the PS does seem to handle it. My board is quite full, but I didn't run out of pins! Fun!
@adamcurtice3584
@adamcurtice3584 2 жыл бұрын
I completed the homework prior to watching this lesson. The logic was pretty straight forward. I used an If-Else statement to solve the logic. It worked great with very little issues. Thanks for the knowledge.
@orndorff52
@orndorff52 4 жыл бұрын
This one was cake!! The only thing to this point that I’m struggling to conceptualize is the toggle switch. It gets easier the more I practice with it tho
@ansarbalkhi
@ansarbalkhi 4 жыл бұрын
Exactly man
@rawadhasan9111
@rawadhasan9111 3 жыл бұрын
I can agree
@captaineverythingfun52
@captaineverythingfun52 3 жыл бұрын
I absolutely agree 🙂
@williamhandlebar9585
@williamhandlebar9585 2 жыл бұрын
Yes
@victorbischel8001
@victorbischel8001 2 жыл бұрын
@@williamhandlebar9585 the toggle switch was very challenging
@hughpatterson1480
@hughpatterson1480 3 жыл бұрын
As I tell my students, any homework I give you, I do myself. I did the homework because the only way to really learn is to try things on your own. Doing this is really helpful because a day will come when there is no one to guide you but yourself. Thanks for another great video.
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Great job!
@ericsmith7988
@ericsmith7988 4 жыл бұрын
I used the tilt switch and also used the photo detector,. they work great together. The motor does slow down with low light and full speed at full light. Thank you Paul always a good day to watch your lessons.
@moniftormos6881
@moniftormos6881 4 жыл бұрын
Great teacher ! I have been watching your videos since a week and now I have reached this lesson. Wish you a great day for you and you granddaughter.
@travisrichardson5366
@travisrichardson5366 5 жыл бұрын
My coding was slightly different initially, but still got it to work. Yours was definitely more streamlined. On to my next homework assignment.
@pratikdas1780
@pratikdas1780 3 жыл бұрын
Did it on my own, sir. Thank you for all the lessons. 38 down. 20 more to goooooo!!!
@pratikdas1780
@pratikdas1780 3 жыл бұрын
*30 more to go lol. sorry for the typo.
@danielsaenz5570
@danielsaenz5570 2 жыл бұрын
I did it ;) (it was kind of easy) Thanks so much for all these AMAZING TUTORIALS!! These homework assignments are so important I am so glad you do them!!
@michaelw24401
@michaelw24401 4 жыл бұрын
I did what you did except I inverted the read from the tilt switch so that when it was in the OK position I was reading "1" from the tilt switch, that way I could simply multiply the motor speed variable by the result of the tilt switch read and if the device is OK the motor would run and if the device were "tilted" the result "0" multiplied by the speed variable would, of course, result in "0" effectively shutting off the motor. I like to avoid using conditional statements when I can as it slows down program execution. Also I was a bit confused when you gave the assignment as to if you were expecting us to use the tilt switch and hard wire it to electrically break the circuit or use it as a sensor and use program control to shut it down. I opted for the later as I figured it was mostly a coding exercise. Thanks again. I'm learning a lot.
@panzerblitz8226
@panzerblitz8226 2 жыл бұрын
I did the HW before watching , and it was working, thanks to your great explanations about tilt function earlier! Thanks again, you are the perfect teacher.
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Excellent!
@andrewhodson8346
@andrewhodson8346 3 жыл бұрын
Hi Paul. Did my homework and very close to your solution. I also pointed out your baud rate error in my comments to Tutorial 37. Really enjoying these tutorials. Thanks
@leebasham1107
@leebasham1107 3 ай бұрын
Hi Paul, I incorporated the tilts witch and again used the pinMode(tiltPin, INPUT_PULLUP) ; as this reduces the code by a line(one less to get wrong). I found that like yours in the video there was a delay between the tilt switch activating and the fan stopping so I played around with the delay times and took the kick play down to 50mS and the delay after the analogWrite(speedPin,mSpeed); line down to 100mS and this gave a nice snappy response and I was also able to get it to start back up when righted at an initial speed of 75. I wish I hadn't torn down the joystick board now ( I have 2 UNO boards) still its all part of the lesson. Off I go to the homework bench. Great job as usual.
@donalddalrymple1776
@donalddalrymple1776 5 жыл бұрын
My version was about 90% the same as your version including pin and variable names. I lean toward the if/else versus the if/if approach. Good lesson, getting more comfortable with the thought process for the design. Keep it up, thanks.
@johntello8904
@johntello8904 3 жыл бұрын
I did my homework. I only added one if statement in my code, so that when tiltVal == 1, the command digitalWrite(speedPin, LOW) was executed. Thanks for the great lesson Paul!
@warsteelcalgarus5790
@warsteelcalgarus5790 Жыл бұрын
I am now able to add the tilt cut off with flashing red LED. Control the speed of the motor with a potentiometer. Turn the whole thing off and on and reset the tilt state with a button. I just wanted to take the time before finishing this video to let thank you for this series! You taught me how to do Fusion 360 and I'm so happy to continue to be able to learn from you. Reply
@aynursunagatullin7029
@aynursunagatullin7029 4 жыл бұрын
Hey Mr.McWhorter, ,I did this homework on my own, worked perfectly! heres the code: int dirPin1=4; int dirPin2=3; int mSpeed=255; int tiltPin=2; int tiltVal; void setup() { // put your setup code here, to run once: pinMode(speedPin,OUTPUT); pinMode(dirPin1,OUTPUT); pinMode(dirPin2,OUTPUT); Serial.begin(9600); pinMode(tiltPin,INPUT); digitalWrite(tiltPin,HIGH); } void loop() { // put your main code here, to run repeatedly: tiltVal=digitalRead(tiltPin); if(tiltVal==0){ analogWrite(speedPin,mSpeed); digitalWrite(dirPin1,LOW); digitalWrite(dirPin2,HIGH); } if(tiltVal==1){ analogWrite(speedPin,0); digitalWrite(dirPin1,LOW); digitalWrite(dirPin2,LOW); } Serial.println(tiltVal); }
@tdc485
@tdc485 4 жыл бұрын
I did it myself. I also added a potentiometer to control the speed and a button to change direction. Off to do the joystick assignment now.
@ianteague2929
@ianteague2929 2 жыл бұрын
I'm definitely doing my homework. And I do watch all the way to the end of every episode .
@JohnSmith-lp5en
@JohnSmith-lp5en 2 жыл бұрын
Hey Paul, I sure did the home work plus I added the green and red LED to show a visual warning if the fan tipped over.
@marksholcomb
@marksholcomb 3 жыл бұрын
Did homework, but, simply put the tilt switch in series with Vcc. Thanks for another great lesson.
@johnganci933
@johnganci933 5 жыл бұрын
My solution was essentially what you did, but with one difference: the motor is only turned on or off at most once per loop() iteration. That is, the motor is initially turned on in setup(). The logic in loop() uses logic similar to the logic you used in Tutorial 34 about using a pushbutton, where the previous button state is compared to the current button state to determine whether the button was toggled. Here we compare the previous tilt state to the current tilt state; if we went from not tilted to tilted, then turn the motor off; if we went from tilted to not tilted, then turn the motor on; otherwise, do nothing. Pseudocode for loop() follows. ***** Begin loop() pseudocode ***** read tiltVal if (tiltValPrev == 0 && tiltVal == 1) then turn the motor off else if (tiltValPrev == 1 && tiltVal == 0) then turn the motor on endif tiltValPrev=tiltVal ***** End loop() pseudocode ***** This avoids having to turn the motor on or off for every loop() iteration; however, it may violate "best practices" for Arduino coding. For my own edification, I decided to jazz this up to add a pushbutton that, when toggled, turns the motor on or off; each toggle of the button either turns the motor on or turns it off. When tilted, toggling the button still keeps track of whether the motor is logically on or off, but does not actually turn it on or off. When the motor is no longer tilted, the motor is turned on or left off depending on (1) its state when it went from not tilted to tilted, and (2) how many motor state changes resulted from toggling the button while tilted. This mimics a small tabletop heater that has a "tilt detector" that shuts the heater off if it tilts over. One can turn the on/off switch as much as desired; when you the heater is eventually set upright, it will either be on or off, depending on how the switch is set. Way too much information! However, as a retiree, I am having a lot of fun following your tutorials. Keep up the good work!
@kylemackenzie955
@kylemackenzie955 3 жыл бұрын
Hi John, i am trying to do exactly what you have done but the code is getting me. only difference is i am using a limit switch instead of a tilt switch but i would think it would be the same. anychance you could share the code you used. very new to this.
@johnganci933
@johnganci933 5 жыл бұрын
I've completed the homework and look forward to comparing your solution, to be shown in lesson 39.This was a fun assignment. On another note, I did not buy my Elegoo kit at the beginning of this series, so I have a lot of earlier lessons to do. One of those, lesson 22 (active buzzer), has homework to add a potentiometer to sound the buzzer when the potentiometer has a value greater than or equal to 1000. I decided to do this one. Since my breadboard is currently set up for lesson 38, the Arduino 5V pin is in use by the joystick. The potentiometer needs 5V, GND, and an Arduino analog pin. Rather than use the Arduino 5V pin, I thought that, since the power board that is already on my breadboard outputs 5V, I would use that with the potentiometer. Much to my surprise, when turning the potentiometer from low to high, the value went from 0 to around 995. Adding code as shown in lesson 12 (potentiometer) to also show voltage, the 995 value corresponds to 4.86V, a little shy of 5V. I am using an AC-DC adapter to power the power board. I did verify that the AC-DC adapter is outputting 9.03V, so it appears to me that my power board is not outputting 5V. Just to doublecheck, I did hook up the potentiometer directly to the Arduino 5V pin. In that case, the maximum potentiometer value (and voltage) is 1023 (and 5.00V), as expected. Could someone here check if their power boards behave similarly? The simplest test is to repeat lesson 12 (potentiometer), but hook it to 5V and GND on the lesson 38 breadboard layout so that it is powered by the power board. This is not a problem, just a surprise. The DC motor and stepper motor lessons work fine, even if the power board outputs slightly less than 5V.
@StefanEckhardt-y6r
@StefanEckhardt-y6r Жыл бұрын
Hi Paul, I looked the lesson until the end :-) ...and I made my homework! I appreciate your effort for teaching us very much! Thank you a lot!!!
@tiberiumihaescu7348
@tiberiumihaescu7348 4 жыл бұрын
I'm watching your videos up until the last second. Thank you so much for your work!
@jbelmont72
@jbelmont72 Жыл бұрын
love these. I used a nested if loop to give the motor the "kickstart" so I could initiate spinning at a lower RPM.
@clairsmyers3571
@clairsmyers3571 5 жыл бұрын
Mr McWhortor, I just received the elegoo super starter kit today. I should have gotten that a long time ago. I had a problem getting the board going but checked the com channel and it was different than my Arduino. I changed that and, it is working fine and ran the sketches that I uploaded to it. I'm good to go and now I have the sensors to follow your videos. Thanks for the advice. That starter kit is absolutely the way to go.
@srduke
@srduke 5 жыл бұрын
I absolutely love these lessons. Lets have a "Yippy i yay" for Paul
@robertschuldenfrei2402
@robertschuldenfrei2402 Жыл бұрын
Did the homework successfully before this lesson. Did it two ways. 1/ like you did with the simple "if" on the tilt switch and 2/ with the state change as in lesson 29.
@pappgergely5031
@pappgergely5031 4 жыл бұрын
Thank you Paul! I am happy to have you here!
@dkouloumis
@dkouloumis 2 жыл бұрын
Thanks
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Thanks, I really appreciate it!
@noelomeli1520
@noelomeli1520 3 жыл бұрын
Homework done and now on to the next one! Thank you for the great lessons!
@EdwardRLyons
@EdwardRLyons 3 жыл бұрын
Yes, Sir, I did the homework! It was nice and straightforward to incorporate the idea for the tilt switch from Tutorial #36 with the code from #37 to control the on/off of the DC motor. I think I must be learning something here! 8-) The only differences I have were to use if ... else instead of two ifs., and my pinMode is (tiltPin,INPUT_PULLUP), as per a suggestion in a comment in an earlier video.
@thefierceninja2557
@thefierceninja2557 2 жыл бұрын
I did the homework with flawless victory! Can't wait to start on the joystick controls!
@georgeshaiffer2246
@georgeshaiffer2246 3 жыл бұрын
Paul Still only watching the complete videos. My goal is learning to READ arduino code. Future plan is to then return to the very first lesson and repeat each one in succession actually' doing the activity. I do have the kit now and I am getting familiar with it as I watch. Normal mode is to watch to near the end and stop the video, depending on time available hold in that state or go to the next one. Thank You, this is the first set of videos that I have stayed with.
@michaeldalfonzo3912
@michaeldalfonzo3912 3 жыл бұрын
Did the homework and got it working just fine. This one was easy.
@pralaymajumdar7822
@pralaymajumdar7822 5 жыл бұрын
Yes sir.....I am able to do the homework....I am eagerly waiting for the next Tuesday at 9:30 pm in India....Thank you.
@lordstelanthin
@lordstelanthin 4 жыл бұрын
I did the homework basically the same as you. The only difference I also put the motor directions in my if statements, which I realize now was unnecessary.
@roncarrier4205
@roncarrier4205 2 ай бұрын
I did this for homework last lesson, but used if else. It worked for a while but then I started getting both one and zero tiltVal readings when it was tipped. Realized I needed to fake a pulldown resister using digitalWrite high. Then it worked consistently.
@TheSelfUnemployed
@TheSelfUnemployed 2 жыл бұрын
The tilt switch homework was easy and ill be getting to work on the joystick HW in the morning as it is getting late. Thanks you Paul!
@higuy2k
@higuy2k 4 жыл бұрын
Did the homework between lessons. Got it working, after watching you code it, I had to look over my shoulder to see if you had watched me write the code, almost identical right down to variable names. 😀
@Японскийшагзашагом
@Японскийшагзашагом Жыл бұрын
Assignment is completed! Love your lessons and started to learn math because of your inspiration! Thank you very much.
@pudgepatenaude3481
@pudgepatenaude3481 3 жыл бұрын
Boom, done already on my own from homework assignment. you are an excellent teacher. thanks so much.
@pokerface68
@pokerface68 3 жыл бұрын
This was a fun easy project. I set mine up very similar to yours except mine worked correctly the first time because I did a digitalRead(tiltPin) instead of analogRead(tiltPin) like you did. The other difference I had was instead of using analogWrite(speed_pin,0); I created and used another variable - motorOff=0 to shut off the motor using analogWrite(speed_pin,motorOff); Once again, thank you for a fine lesson!
@malcolmbrandon6806
@malcolmbrandon6806 2 жыл бұрын
Keyword Rose and Ronald Another great lesson, I am planning to use a DC motor to drive my observatory dome using mirror tiles fitted every 10 degrees around the dome and for position control with infrared photo sensors. I have learnt a great deal so far
@philnewman1110
@philnewman1110 Жыл бұрын
Still there watching all the way through to the very end Paul, as always a very interesting tutorial, thanks again!!
@thysdelport6782
@thysdelport6782 2 жыл бұрын
Done and dusted. Added two motors due to the use of L298N board. Great tutorial yet again.
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Nice work!
@agustinruiz2081
@agustinruiz2081 2 жыл бұрын
I got it before to watch the video, basically it was easy applying the concepts I learnt in the 2 previous videos . I am looking forward to doing the next homework with the joystick.
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
Great job!
@christianbrown9550
@christianbrown9550 11 ай бұрын
I put the tilt resistor in series with the fan power. Works great and doesn't require any change to the code. I know it's not in the spirit of the homework, but it's basically a 0ohm switch.
@hitormissgna
@hitormissgna 3 жыл бұрын
I did the homework and was yelling at you for the analogWrite but you ignored me. Haha. Only difference is that I use and else statement instead of a second if statement. Thanks again.
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Excellent!
@dougnash6316
@dougnash6316 5 жыл бұрын
Not having much luck with some of the Elegoo components. I revisited lesson 37 because I ended up taking 5v directly from the Uno to pin 8 on the mtr controller to make the motor work. The power supply board is only giving 2.6v. Now the motor is making some background noise and won't start at 90rpm. I have to start at about 150. This is my 4th bad component. They did replace the Pot and the joystick but now I have either a bad power supply or mtr controller and a bad motor. Thankfully this stuff is very cheap to buy. I like that you are putting the code and diagrams on you TTB site. Cool modded tinkercad like diagram.
@hasan-motam
@hasan-motam 2 жыл бұрын
I did the homework without a problem. Thanks once again Paul.
@RavensHammer00
@RavensHammer00 Жыл бұрын
Watched to the end, and your coding was almost exactly like mine! Thank you! Off to do more homework!
@paulmcwhorter
@paulmcwhorter Жыл бұрын
Excellent!
@mrktm65sx
@mrktm65sx 11 ай бұрын
Completed homework on my own. Looking forward to the next tutorial. Thanks Paul!
@blazenbunny84
@blazenbunny84 3 жыл бұрын
Tried it hands on and was successful in completing my homework :) Thankyou so much!!!
@stephenmarshall1286
@stephenmarshall1286 4 жыл бұрын
Yes did the homework and worked great. I like the fact you make mistakes (whether deliberate or not) as this makes us analyse the issue.
@aaronmooney2430
@aaronmooney2430 3 жыл бұрын
Successfully completed the homework. Only difference is that I had the if statements only redefine the motor speed, then I still had the digitalWrite and analogWrite commands after.
@shardyphotographic
@shardyphotographic Жыл бұрын
Hi Paul, I did the homework and got it to work. I wrote the same code as you created, but added two extra variables : mSpeedStart=250 & mSpeedStop=0 then I used these variables in the if statements, although mine worked, I wrote more unnecessary code. Thanks again Paul
@wayneandrews1738
@wayneandrews1738 Жыл бұрын
I connected the tilt switch to Arduino pin A0 to chip pin 5. If tilted the input becomes 0 and the motor stops. In real power motor applications, you would use a tilt tin in the control circuit, not direct power running the motor. I realized that 512 was a starting point, so you would need two slopes, one positive, one negative. Two if statements. We at starting in the middle of the X axis from 0 to 1023. 0 is the still, and 255 is the highest for mSpeed for the motor. Wayne - - Moderately hard. Again having an old lesson open while working on a new lesson is better than from scratch.
@santiagoperaza967
@santiagoperaza967 Жыл бұрын
could do the HW from last episode no problem... I wanted to add more functions but my batteries die to fast , I ordered a lithium battery hopping this can help me get more creative. I added a Servo and a joystick , I could control the speed and direction with the joystick . very long code , I still cant believe it worked !!! thank you Mrs Paul.
@sssagc
@sssagc 3 жыл бұрын
Yes I did the homework in Lesson 37, but used the tilt sw to drive both IN1 and IN2 HIGH, to stop the motor.
@ShockingTips
@ShockingTips Жыл бұрын
I was thinking about where a tilt switch is used and there is one in my portable heater that shuts it off to prevent fires. It also turns on a red light. Really useful information 👍
@robertherzog2087
@robertherzog2087 5 жыл бұрын
I did the homework but was unsuccessful on several levels. I had bad connections because of loose wires, wrong pin connections caused by troubleshooting the loose wires and then bad coding because of it all. In my own defense, my original code was very similar to what you did, however, my tilt switch did intermittent 1's and 0's, even when the tilt switch was removed from the board. I thought I had a defective switch but an Ohm test showed it was good. The final result was I had the switch plugged into the tX1 connection instead of pin 2. My vision isn't good enough to see these tiny numbers and wires. But hey, I don't have enough hair anymore to worry about pulling it out!
@SimonChil
@SimonChil 4 жыл бұрын
Of course i've done my homework. Always do! I even tried to go further including a joystick on my own but i'll have to wait for the next lecture to figure it out.
@Rob_TheOne
@Rob_TheOne 3 жыл бұрын
Using this to control an rc crawler thank you! Back to the servo and IR control lessons. Glad I did my homework and mapped my buttons.
@Mrgasman1978
@Mrgasman1978 Жыл бұрын
Rose amd Ronald! I always watch all videos to the end and more than once!.
@1271344able
@1271344able 3 жыл бұрын
I did my homework before watching the video worked great. Todays homework is going to be fun really like how you assign homework to test your viewers learning progression though these series of videos.
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Great job!
@masterdisasterklaus9994
@masterdisasterklaus9994 4 жыл бұрын
Nice Video. But I’m wondering how the program works. At 5:30 you set the “ pinMode (tiltPin,OUTPUT);” but it should be a Input to read the tiltSwitch. I’m wrong?
@hannes_rdu7796
@hannes_rdu7796 4 жыл бұрын
Loving these lessons! FYI, I noticed that Paul keeps referring to the trick of doing a digitalWrite to a digital input pin to have it activate a pullup resistor for that pin. I noticed that there is an easier way to do this and that the Arduino docs even recommends doing it this way: When initializing the pin, simply use a command like this: pinMode(3,INPUT_PULLUP); This is effectively the same as specifying that the pin is an input pin AND doing the digitalWrite in a single command.
@tedsykora1858
@tedsykora1858 4 жыл бұрын
watching start to finish and doing the homework. Fun and helpful series.
@matthewstone898
@matthewstone898 Жыл бұрын
Was able to do this, simple enough and added a active buzzer as part of the tilt.
@AlexDavis-ch1ro
@AlexDavis-ch1ro Жыл бұрын
Super challenging homework, but mostly was able to do it. Thanks for your great instruction!
@paulmcwhorter
@paulmcwhorter Жыл бұрын
Great job!
@TheParksy72
@TheParksy72 3 жыл бұрын
did the homework, love that I just know how to do it. It's all thanks to you, my good sir.
@richardletourneau2672
@richardletourneau2672 5 жыл бұрын
I did the assignment after few corrections it work OK. After I put the decimal point everything work fine. Thanks again.
@thomascolley9784
@thomascolley9784 Жыл бұрын
Hi Paul, nice work as usual. I learn a lot from your videos. I do the homework and have had some success. Have that I keep getting distracted coming up with silly projects of my own by combining different lessons. Thanks for your help
@paulmcwhorter
@paulmcwhorter Жыл бұрын
Excellent
@PedroLuis-yp9ed
@PedroLuis-yp9ed 3 жыл бұрын
Yup. Did the hw and now going to do this one with the joystick. I'm so close to phase 3 which is to use all this and build a robot. I still love how you teach btw.
@CarolinaDGF
@CarolinaDGF 3 жыл бұрын
Easy - once I remembered to do the resistor trick on the tiltPin. :) I am very much enjoying this series.
@paulmcwhorter
@paulmcwhorter 3 жыл бұрын
Cool, thanks
@richardbritain7435
@richardbritain7435 2 жыл бұрын
Brilliant!! I managed the tilt and stop homework on my own. The next project looks tricky though. Thanks.
@steveschad103
@steveschad103 3 жыл бұрын
I did do the assignment and was successful. My code was like yours for the most part. One small difference.
@calvindeiterich9913
@calvindeiterich9913 Жыл бұрын
I kept the tilt pin as digital and read 1 or 0. Also did the and if/else for the motor control.
@markfuentes3666
@markfuentes3666 5 жыл бұрын
I complete the home work. Worked great. Did it the same as you. Thanks for these videos.
@johnkafer5061
@johnkafer5061 4 жыл бұрын
yup, did homework and solved it......you are an excellent teacher, giddyup...
@KoewachtDynamics
@KoewachtDynamics 5 жыл бұрын
Did my homework: A++ Up to the next one!
@doverivermedia3937
@doverivermedia3937 Жыл бұрын
Yep, did the HWrk, and used 2 x If's (not an 'else') , Like you advised before... but used 'digitalRead' not 'analogRead' off pin 2. worked a treat ...
@dflyfpv8765
@dflyfpv8765 4 жыл бұрын
If you add the tilt switch before the enable pin it works also good, no delay lol. I can imagine adding that together with the coded solution makes it twice more secure. Nice.
@mikeeirish4677
@mikeeirish4677 3 жыл бұрын
Hi Paul. I tried to do the homework from the last lesson, but I was not successful. I was able to get the fan to move, but it seemed that I just turned it on and did not incorporate the tiltswitch properly. I tried to set the tiltSwitch to 1, and then put in an if statement to turn the fan speed to zero if the tiltswitch read 0. so I'm looking forward to finding out in this video where I went wrong and to see if I can correct my thinking.
@kevhopkins984
@kevhopkins984 4 жыл бұрын
Enjoyed, and yes I did do the Homework, not quite the same way you did, but still with success.
Arduino Tutorial 37: Understanding How to Control DC Motors in Projects
31:25
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 148 МЛН
AS5600 magnetic position encoder - best encoder for stepper motors
48:18
Curious Scientist
Рет қаралды 116 М.
Arduino Tutorial 28: Using a Pushbutton as a Toggle Switch
21:58
Paul McWhorter
Рет қаралды 299 М.
3 engineers race to design a PCB in 2 hours | Design Battle
11:50
Predictable Designs
Рет қаралды 492 М.
Arduino Tutorial 33: Understanding How to Control Servos with a Joystick
49:14
Arduino DC Motor Control Tutorial - L298N | H-Bridge | PWM | Robot Car
9:59
How To Mechatronics
Рет қаралды 1,2 МЛН
#123 Arduino Auto Shutdown (and switch off)
34:47
Ralph S Bacon
Рет қаралды 29 М.
How to use a relay as a Kill Switch or safety switch
19:01
⚙️Homie Hektor⚙️
Рет қаралды 269 М.
How to control DC motor with L298N driver and Arduino
5:48
Circuit Magic
Рет қаралды 442 М.
Mac Mini M4 - ОН ИЗМЕНИТ ИГРУ
17:47
ЗЕ МАККЕРС
Рет қаралды 79 М.
ПРАВДА ЛИ ТЕЛЕФОНЫ 2000х БЕССМЕРТНЫ ?
28:53
My JBL GO Collection 🔊
0:11
Bass Super Test
Рет қаралды 1,4 МЛН
СДЕЛАЙ ТАК . Пульт будет работать вечно
9:39
Мужские интересы 79
Рет қаралды 604 М.