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

Sdílet
Vložit
  • čas přidán 10. 09. 2024
  • 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:
    / paulmcwhorter
    In today's lesson we demonstrate how to incorporate a tilt switch cutoff into a DC motor project. This is a useful method for cases where you would like to automatically turn your motors off in the case your project/device turns over or tips. This feature can be useful in a number of different projects and prototypes.
    You can get the kit I am using for this series at the following link:
    amzn.to/2I7N4Ek
    Follow these lessons on our FREE web site:
    toptechboy.com...
    [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. This means if you visit the link and purchase the item, I will receive an affiliate commission. Regardless, I only recommend products or services I use personally and believe will add value to my readers.]
    #Arduino

Komentáře • 407

  • @coltongerber4498
    @coltongerber4498 Před 2 lety +19

    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 Před rokem

      Great idea, Colten!

  • @LeonJakub
    @LeonJakub Před 3 lety +6

    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!

  • @arseivan
    @arseivan Před rokem +3

    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);
    }

  • @tntragan
    @tntragan Před 2 lety +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.

  • @Anmol-AK
    @Anmol-AK Před 8 měsíci +2

    Completed the homework under 30 minutes on my own. Thanks a lot for your teaching sir

  • @nickr8747
    @nickr8747 Před 4 lety +6

    Keep doing these videos. they may not be crazy popular, but you have no idea how much these videos help us.

  • @orndorff52
    @orndorff52 Před 4 lety +28

    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

  • @christophechalons9072
    @christophechalons9072 Před 3 lety +2

    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 !

  • @VegasGuy89183
    @VegasGuy89183 Před rokem +2

    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 Před rokem

      Haha, putting the tilt switch on extensions was a great idea, thanks!

  • @travisrichardson5366
    @travisrichardson5366 Před 4 lety +1

    My coding was slightly different initially, but still got it to work. Yours was definitely more streamlined. On to my next homework assignment.

  • @bleujaegel
    @bleujaegel Před rokem +1

    Made it through the homework unscathed. Love the homework assignments!

  • @MarvPerk3
    @MarvPerk3 Před 3 lety +1

    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!

  • @dannycollins5698
    @dannycollins5698 Před rokem

    Finished the homework before watching this. I used an else statement instead of another if statement.
    Thank God for you! God bless you sir!

  • @caripatd232441
    @caripatd232441 Před 3 lety +2

    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.

  • @jbelmont72
    @jbelmont72 Před rokem

    love these. I used a nested if loop to give the motor the "kickstart" so I could initiate spinning at a lower RPM.

  • @thefierceninja2557
    @thefierceninja2557 Před 2 lety

    I did the homework with flawless victory! Can't wait to start on the joystick controls!

  • @tdc485
    @tdc485 Před 3 lety

    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.

  • @warsteelcalgarus5790
    @warsteelcalgarus5790 Před rokem

    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

  • @matthewstone898
    @matthewstone898 Před 10 měsíci

    Was able to do this, simple enough and added a active buzzer as part of the tilt.

  • @TheSelfUnemployed
    @TheSelfUnemployed Před 2 lety

    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!

  • @michaeldalfonzo3912
    @michaeldalfonzo3912 Před 2 lety

    Did the homework and got it working just fine. This one was easy.

  • @andrewhodson8346
    @andrewhodson8346 Před 3 lety

    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

  • @philnewman1110
    @philnewman1110 Před rokem

    Still there watching all the way through to the very end Paul, as always a very interesting tutorial, thanks again!!

  • @sammysam1503
    @sammysam1503 Před 4 lety

    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);
    }
    }

  • @agustinruiz2081
    @agustinruiz2081 Před 2 lety

    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.

  • @danielsaenz5570
    @danielsaenz5570 Před 2 lety +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!!

  • @robertschuldenfrei2402
    @robertschuldenfrei2402 Před 9 měsíci

    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.

  • @michaelw24401
    @michaelw24401 Před 4 lety

    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.

  • @christianbrown9550
    @christianbrown9550 Před 7 měsíci

    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.

  • @navigator2011
    @navigator2011 Před 11 měsíci

    Yes, I did the homework and got it working before this episode. Used, basically, the same approach as in this episode.

  • @lordstelanthin
    @lordstelanthin Před 3 lety

    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.

  • @ShockingTips
    @ShockingTips Před rokem

    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 👍

  • @jabber2824
    @jabber2824 Před 4 měsíci

    Yes I always do the homework and watch to the end :-) Great stuff incorporating earlier learned stuff.

  • @hughpatterson1480
    @hughpatterson1480 Před 2 lety

    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.

  • @mrktm65sx
    @mrktm65sx Před 8 měsíci

    Completed homework on my own. Looking forward to the next tutorial. Thanks Paul!

  • @johnganci933
    @johnganci933 Před 4 lety +1

    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 Před 2 lety

      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.

  • @hasan-motam
    @hasan-motam Před rokem

    I did the homework without a problem. Thanks once again Paul.

  • @adamcurtice3584
    @adamcurtice3584 Před 2 lety

    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.

  • @katherineclarke4435
    @katherineclarke4435 Před 3 lety

    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!

  • @RavensHammer00
    @RavensHammer00 Před rokem

    Watched to the end, and your coding was almost exactly like mine! Thank you! Off to do more homework!

  • @georgeshaiffer2246
    @georgeshaiffer2246 Před 3 lety

    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.

  • @aaronmooney2430
    @aaronmooney2430 Před 3 lety

    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.

  • @LinkLiu1989
    @LinkLiu1989 Před 4 lety

    Yes,I did the assignment myself, but make a mistake , finally figured it out in this video

  • @thysdelport6782
    @thysdelport6782 Před 2 lety

    Done and dusted. Added two motors due to the use of L298N board. Great tutorial yet again.

  • @ianteague2929
    @ianteague2929 Před rokem

    I'm definitely doing my homework. And I do watch all the way to the end of every episode .

  • @KoewachtDynamics
    @KoewachtDynamics Před 4 lety +14

    Did my homework: A++ Up to the next one!

  • @santiagoperaza967
    @santiagoperaza967 Před rokem

    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 Před 3 lety

    Yes I did the homework in Lesson 37, but used the tilt sw to drive both IN1 and IN2 HIGH, to stop the motor.

  • @aynursunagatullin7029
    @aynursunagatullin7029 Před 3 lety

    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);
    }

  • @richardbritain7435
    @richardbritain7435 Před 2 lety

    Brilliant!! I managed the tilt and stop homework on my own. The next project looks tricky though. Thanks.

  • @blazenbunny84
    @blazenbunny84 Před 3 lety

    Tried it hands on and was successful in completing my homework :) Thankyou so much!!!

  • @1271344able
    @1271344able Před 3 lety

    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.

  • @Mrgasman1978
    @Mrgasman1978 Před rokem

    Rose amd Ronald! I always watch all videos to the end and more than once!.

  • @marksholcomb
    @marksholcomb Před 3 lety

    Did homework, but, simply put the tilt switch in series with Vcc. Thanks for another great lesson.

  • @pratikdas1780
    @pratikdas1780 Před 3 lety

    Did it on my own, sir. Thank you for all the lessons. 38 down. 20 more to goooooo!!!

  • @tiberiumihaescu7348
    @tiberiumihaescu7348 Před 4 lety +1

    I'm watching your videos up until the last second. Thank you so much for your work!

  • @panzerblitz8226
    @panzerblitz8226 Před 2 lety

    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.

  • @davidrender4028
    @davidrender4028 Před 2 lety

    I did my homework, added a offSpeed=0 for my if statement tiltVal==1. Maybe a little crude but it worked

  • @pappgergely5031
    @pappgergely5031 Před 4 lety

    Thank you Paul! I am happy to have you here!

  • @peterfinch8774
    @peterfinch8774 Před 2 lety

    Boom, would you look at that. Learning all things arduino with you is fun. Yes doin the home work, was delighted when the tilt I did in less lines. I did tiltPin,INPUT_PULLUP then one if (digitalRead tiltPin==HIGH){analogWrite (speedPin,0);} noooo don’t put numbers in the void.
    Thank you from Ireland for all your hard work and expertise.

  • @user-ys6bc7yh7z
    @user-ys6bc7yh7z Před 10 měsíci

    Assignment is completed!
    Love your lessons and started to learn math because of your inspiration!
    Thank you very much.

  • @ericsmith7988
    @ericsmith7988 Před 4 lety

    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.

  • @johnkafer5061
    @johnkafer5061 Před 4 lety

    yup, did homework and solved it......you are an excellent teacher, giddyup...

  • @steveschad103
    @steveschad103 Před 3 lety

    I did do the assignment and was successful. My code was like yours for the most part. One small difference.

  • @srduke
    @srduke Před 4 lety +2

    I absolutely love these lessons. Lets have a "Yippy i yay" for Paul

  • @AlexDavis-ch1ro
    @AlexDavis-ch1ro Před rokem

    Super challenging homework, but mostly was able to do it. Thanks for your great instruction!

  • @noelomeli1520
    @noelomeli1520 Před 3 lety +1

    Homework done and now on to the next one! Thank you for the great lessons!

  • @PedroLuis-yp9ed
    @PedroLuis-yp9ed Před 3 lety

    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 Před 3 lety

    Easy - once I remembered to do the resistor trick on the tiltPin. :) I am very much enjoying this series.

  • @kevhopkins984
    @kevhopkins984 Před 3 lety

    Enjoyed, and yes I did do the Homework, not quite the same way you did, but still with success.

  • @wayneandrews1738
    @wayneandrews1738 Před rokem

    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.

  • @moniftormos6881
    @moniftormos6881 Před 4 lety

    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.

  • @Rob_TheOne
    @Rob_TheOne Před 3 lety

    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.

  • @user-vf7fx2ff9d
    @user-vf7fx2ff9d Před rokem

    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!!!

  • @johntello8904
    @johntello8904 Před 3 lety

    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!

  • @alessandromoruzzi7386
    @alessandromoruzzi7386 Před 2 lety

    I’m starting to think like you! As i was ending the homework for this lesson i thought, why not use a joystick to control the speed and maybe stick it on a servo so i can toggle the fan angle 😂….. this lesson ends and you say, now try using a joystick! Fantastic!

  • @hannes_rdu7796
    @hannes_rdu7796 Před 4 lety +2

    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.

  • @TheRealFrankWizza
    @TheRealFrankWizza Před 4 lety

    Interestingly, in the homework, I had my tilt pin set to output instead of input and it worked.

  • @SimonChil
    @SimonChil Před 4 lety

    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.

  • @shardyphotographic
    @shardyphotographic Před rokem

    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

  • @ledogu
    @ledogu Před 2 lety

    Thank you again, I added a Red & Green LED to indicate Up or Down Status.

  • @donalddalrymple1776
    @donalddalrymple1776 Před 4 lety

    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.

  • @doverivermedia3937
    @doverivermedia3937 Před rokem

    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 ...

  • @hitormissgna
    @hitormissgna Před 3 lety

    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.

  • @pudgepatenaude3481
    @pudgepatenaude3481 Před 3 lety

    Boom, done already on my own from homework assignment. you are an excellent teacher. thanks so much.

  • @lesliejames5722
    @lesliejames5722 Před 2 lety

    Rose and Ronald, another good lesson thanks Paul.

  • @tonyperry6702
    @tonyperry6702 Před 4 lety

    Did my homework. It worked perfectly.

  • @MikeRub5001
    @MikeRub5001 Před 4 lety +1

    The word is rose. I listen to all luctures

  • @malcolmbrandon6806
    @malcolmbrandon6806 Před rokem

    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

  • @TheParksy72
    @TheParksy72 Před 3 lety

    did the homework, love that I just know how to do it. It's all thanks to you, my good sir.

  • @JohnSmith-lp5en
    @JohnSmith-lp5en Před 2 lety

    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.

  • @HappyJones725
    @HappyJones725 Před 8 měsíci

    I was able to complete the tilt switch stop homework, I used 1 while loop rather than 2 if commands like you did though.

  • @kevincornelia4067
    @kevincornelia4067 Před 3 lety

    Did the homework on my own👌. My code was a bit different but it worked the same! Used and if, else statement 👍🏻.

  • @robertherzog2087
    @robertherzog2087 Před 4 lety

    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!

  • @pralaymajumdar7822
    @pralaymajumdar7822 Před 4 lety

    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.

  • @stephenmarshall1286
    @stephenmarshall1286 Před 4 lety

    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.

  • @tony4624
    @tony4624 Před 4 lety

    I did the homework before the lesson. A difference is that I didn't set the speed to zero to stop the fan, I set both direction pins to "LOW". Also, I added the LEDs from the tilt switch lesson. So, when the fan is running, the green LED also lights up, and when the fan is stopped, the red LED lights up.

  • @richardletourneau2672
    @richardletourneau2672 Před 4 lety

    I did the assignment after few corrections it work OK. After I put the decimal point everything work fine. Thanks again.

  • @higuy2k
    @higuy2k Před 4 lety

    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. 😀

  • @ansgarguentsch9130
    @ansgarguentsch9130 Před 3 lety

    Did the homework and got it to work. Only thing I did differently were which pins I used and instead of a analogRead I did a digitalRead.