Raspberry Pi LESSON 4 HOMEWORK SOLUTION: Understanding and Using GPIO Pins

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ธ.ค. 2024

ความคิดเห็น • 87

  • @chrisjowaisas95
    @chrisjowaisas95 6 หลายเดือนก่อน +4

    I cannot believe that my light actually blinked! Thanks, you are a great teacher. I watch in 2x speed and it is like you have had 10 cups of iced black coffee.

  • @ohyeahthatsawesome6234
    @ohyeahthatsawesome6234 2 ปีที่แล้ว +8

    Sir, I want to say Thank you for your efforts to educate us, we really appreciate it. I finished your arduino lessons, started python coding, going well so far (not folding up like a cheap walmart lawnchair) and I just needed to say thank you for all of your classes. You have a faithful audience all over the world. Cheers from Bosnia & Herzegovina!

  • @lalabali8575
    @lalabali8575 2 ปีที่แล้ว +5

    Another faithful student here, thank you! Starting from zero electronics experience, I've followed your entire arduino series and am now dipping into the raspberry pi. It's been a joy and I really appreciate the incredible resource and learning experience you've created. Cheers from Australia

    • @paulmcwhorter
      @paulmcwhorter  2 ปีที่แล้ว +1

      nothing like the feeling of tackleing a hard problem and succeeding. Hopefully these lessons will help you continue to develop your thinking skills, and benefit you in whatever you try and do

  • @jansimurda9998
    @jansimurda9998 2 ปีที่แล้ว +2

    I am legend. Because I didn't manage to buy RPi, I made it for control also with printed output in terminal. And thanks to your great Python lessons I was able to do it all by myself in few minutes and most importantly without using hints and my previous notes. Great feeling.Thank you.

  • @Lehibob
    @Lehibob 2 ปีที่แล้ว +2

    Thanks for this Paul! I am just learning Python and when I did the homework for this I had never seen any reference to the range() function used in for loops. OUTSTANDING!

  • @rockymountainfacet5958
    @rockymountainfacet5958 ปีที่แล้ว +1

    I am Legend. 12am! Ill watch this tomorrow to see how you did it compared to me. I did have one issue. I kept hitting ctrl z out of habbit in other programs. Then I had to type fg + enter to get back my program. Weird but I learned how to fix it. Ctrl z is like a nervous twitch I have. lol. UNDO! UNDO!. P.S. You got me drinking coffee without the sugar or creamer. coffee = ice + jetfuel. You do so much for the world. God bless.

  • @tpobrienjr
    @tpobrienjr 2 ปีที่แล้ว +2

    Enjoyable! Thanks for including your mistakes. We all learn that way.

  • @leeg.1402
    @leeg.1402 2 ปีที่แล้ว +2

    Thanks for the solution Paul. Have a good evening.

  • @fammertens9419
    @fammertens9419 7 หลายเดือนก่อน

    So i finally got my Raspberry to be accesible via Putty and after lesson 4 i've been puzzling for about 1.5 hours why it didn't work wth the LED. Found out that doublechecking reistor values is a virtue! i used a 330K in stead of 330....what a dufus....Thanks for the lessons sofar,, i will be following them all now! Greetings from the Netherlands

  • @James-ts8tc
    @James-ts8tc ปีที่แล้ว

    I am legend.
    This was a fun lesson. This is exactly how I wanted to learn. Looking forward to continuing!

  • @alessandrorhomberg9183
    @alessandrorhomberg9183 ปีที่แล้ว +1

    Really good tutorial, thanks for your efforts :)

  • @Eagle621
    @Eagle621 11 หลายเดือนก่อน +1

    I’m a year late, but I’m 69, so better late than never… Enjoying the classes very much! Thanks for doing these… (I’m learning Arduino as well😊), Cheers

    • @paulmcwhorter
      @paulmcwhorter  11 หลายเดือนก่อน +2

      You are so welcome!

  • @JoRogan-l1v
    @JoRogan-l1v ปีที่แล้ว +1

    I am legend. Thank you again for your excellent tuition.

  • @jonathanlanders9406
    @jonathanlanders9406 ปีที่แล้ว

    I am Legend minus forgetting to use GPIO.cleanup().
    The first few lessons in this series are fantastic. I bought my Raspberry pi 3 a few years back, but I was having trouble learning to navigate the linux environment while simultaneously trying to learn Python. Though I have already taken many of your python lessons (making it easier for me to work with nano), I think your lessons do a great job at clarifying how to function in both environments.

  • @JACKOFALLTODD
    @JACKOFALLTODD 2 ปีที่แล้ว +2

    I liked the video yesterday I listened at work. So I didnt get to do the homework. I think I will try some of these though I am a rookie with arduino and am interested in python.

  • @tkklein
    @tkklein 2 ปีที่แล้ว +1

    love your stuff!

  • @harolddunn8395
    @harolddunn8395 2 ปีที่แล้ว +1

    Thanks Paul. I love watching and learning from your tutorials. One question, I am confused how to determine what voltage is produced from pin 11. How does the GPIO decide. Is it 3.3v since it is from the same column. The wiring diagram said 5vdc so I don’t understand how the GPIO knows what voltage to use. Thank you so much…Cheers from AZ!

  • @lorisrobots
    @lorisrobots 2 ปีที่แล้ว

    I am Legend! I posted my video on Lesson 4. Thx

  • @TaiTai-py2tp
    @TaiTai-py2tp 6 หลายเดือนก่อน

    Did it on the Raspberry pi 5. Setup is a little different as you need to use gpiod library instead.

  • @josenoelcaraballo766
    @josenoelcaraballo766 ปีที่แล้ว +2

    I did it a little differently. The program stops if the user writes 0 for the number of blinks.

    • @James-ts8tc
      @James-ts8tc ปีที่แล้ว +1

      This was my solution too!

  • @hoboken5224
    @hoboken5224 2 ปีที่แล้ว

    Paul, in the future can you take time out to comment on the flora & fauna in the background?

  • @Dr.AhmedQusaySabri
    @Dr.AhmedQusaySabri 10 หลายเดือนก่อน

    Thanks a lot

  • @jessekloberdanz246
    @jessekloberdanz246 2 ปีที่แล้ว

    fun one!

  • @anthonyjackson486
    @anthonyjackson486 6 หลายเดือนก่อน

    Is there a way to follow this tutorial with a pi5 ? as a complete beginner all the information available is beyond my knowledge and apparently the pi5 addresses the GPIO slightly differently and I don't really want to have to go and buy an older pi4

    • @paulmcwhorter
      @paulmcwhorter  6 หลายเดือนก่อน

      The GPIO commands are different. So, either you will need to get a pi4, or you will need to figure out the different commands for writing/reading the GPIO pins.

  • @hungry8560
    @hungry8560 10 หลายเดือนก่อน

    I PROUDLY SAY I AM LEGEND!

  • @fjl05
    @fjl05 2 ปีที่แล้ว

    Would it be logical to also add a GPIO.cleanup() at the beginning of the program incase the GPIO pins where not cleaned up in a previous attempt?

    • @paulmcwhorter
      @paulmcwhorter  2 ปีที่แล้ว

      It is just I am not sure if a new program which might be running in a different terminal can clean up a process started by a different terminal/program. I have gotten some strange results with that.

  • @michaelcarroll4832
    @michaelcarroll4832 2 ปีที่แล้ว

    I would appreciate if someone could tell me how to get Scratch to show all the Raspberry pi in the Extensions (of Scratch?) I read it came with raspberry pi software, I installed the software and I do not have scratch 3. I appreciate all of your time! Thank you PAUL for a great video!

  • @dillatronic4757
    @dillatronic4757 2 ปีที่แล้ว

    Can you make projects on Elisa 3 Robot?

  • @TheUnofficialMaker
    @TheUnofficialMaker 2 ปีที่แล้ว

    You should start your own curriculum for schools but name it Genius!

    • @paulmcwhorter
      @paulmcwhorter  2 ปีที่แล้ว +3

      I find it odd that I offer all of these classes for free but they are never used in public school systems. Public schools spend hundreds of thousands of dollars on STEM curriculum that are completely LAME, yet will not use these lessons I am offering for free. The public school system, my friend, is BROKEN.

    • @TheUnofficialMaker
      @TheUnofficialMaker 2 ปีที่แล้ว

      @@paulmcwhorter yes in more ways than one knows. i think the D push for free college is so they can indoctrinate more of our young people

  • @charlotteswift
    @charlotteswift 2 ปีที่แล้ว

    I already had 4 LEDs set up so I decided to do a binary counter. Here's the code:
    import time
    import RPi.GPIO as GPIO
    LED_GPIO={16,15,12,11]
    num_LEDs=len(LED_GPIO)
    LED_State=[0]*num_LEDs
    count_to=int(input('Enter number you want to count to: '))
    if count_to >= 2**num_LEDs:
    print('Cannot count to', count_to, 'with', num_LEDs,', 'LEDs')
    quit()
    GPIO.setmode(GPIO.BOARD)
    for i in range(0,num_LEDs):
    GPIO.setup(LED_GPIO[i],GPIO.OUT)
    GPIO.output(LED_GPIO[i],LED_State[i])
    for j in range(0,count_to+1):
    temp=j
    for i in range(0,num_LEDs):
    LED_State[i]=int(temp%2)
    temp=temp/2
    GPIO.output(LED_GPIO[i],LED_State[i])
    if temp==0:
    break
    time.sleep(1)
    time.sleep(2)
    GPIO.cleanup()

    • @keithlohmeyer
      @keithlohmeyer 2 ปีที่แล้ว

      Thanks for posting your code. I always learn by looking at how others code a problem.

    • @charlotteswift
      @charlotteswift 2 ปีที่แล้ว

      @@keithlohmeyer I had a typo in line 7

  • @josenoelcaraballo766
    @josenoelcaraballo766 ปีที่แล้ว

    I am legend! 😁

  • @MishaM73
    @MishaM73 ปีที่แล้ว

    I AM LEGEND!

  • @MrCameronMoore
    @MrCameronMoore 2 ปีที่แล้ว

    I am LEGEND : - ))

  • @larryplatzek9017
    @larryplatzek9017 2 ปีที่แล้ว

    Your link for the corrected file does not work.

    • @paulmcwhorter
      @paulmcwhorter  2 ปีที่แล้ว

      Thank you Larry, I just fixed it. Appreciate the note.

    • @larryplatzek9017
      @larryplatzek9017 2 ปีที่แล้ว

      @@paulmcwhorter You are very welcome, others will be happy!

  • @brucemilyko8549
    @brucemilyko8549 2 ปีที่แล้ว

    I am legend (after I fixed all my typos)

  • @paula.jackson5463
    @paula.jackson5463 2 ปีที่แล้ว +1

    i folded like a wallmart lawnchair......but I promise to do better. Been learning Linux hardcore and time gets away!

  • @jothieswari2112
    @jothieswari2112 2 ปีที่แล้ว

    I am legend!

  • @WilliamBurlingame
    @WilliamBurlingame 2 ปีที่แล้ว

    My program is shown below. There seems to be more than one way to verify a valid entry and I would like to see how you would handle it. I also ignore negative numbers
    import RPi.GPIO as GPIO
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(11,GPIO.OUT)
    On = True
    Off = False
    import time
    Delay = 2
    while True:
    NumberOfBlinks = int(input("How many times should I blink the LED? Enter 0 to exit. "))
    if NumberOfBlinks > 0: #use 0 to exit
    count = 0
    while count < NumberOfBlinks:
    GPIO.output(11,On)
    time.sleep(Delay)
    GPIO.output(11,Off)
    time.sleep(Delay)
    count += 1
    if NumberOfBlinks == 0: #exit loop
    break
    GPIO.cleanup()

    • @keithlohmeyer
      @keithlohmeyer 2 ปีที่แล้ว

      Here is how I would handle validation against non integer numbers in your input. It should keep the code from crashing with bad input but I am a noob too so there may be a better way
      import RPi.GPIO as GPIO
      GPIO.setmode(GPIO.BOARD)
      GPIO.setup(11,GPIO.OUT)
      On = True
      Off = False
      import time
      Delay = 2
      while True:
      NumberOfBlinks =input("How many times should I blink the LED? Enter 0 to exit. ")
      try:
      NumberOfBlinks=int(NumberOfBlinks)
      print(NumberOfBlinks)
      if NumberOfBlinks > 0: #use 0 to exit
      count = 0
      while count < NumberOfBlinks:
      GPIO.output(11,On)
      time.sleep(Delay)
      GPIO.output(11,Off)
      time.sleep(Delay)
      count += 1
      if NumberOfBlinks == 0: #exit loop
      break
      except ValueError:
      print('input not an integer')
      GPIO.cleanup()

  • @trevorblanchard923
    @trevorblanchard923 7 หลายเดือนก่อน

    I am a legend

  • @keithlohmeyer
    @keithlohmeyer 2 ปีที่แล้ว

    This is so fun I decided to do a second homework video th-cam.com/video/d1ghhIBtGSY/w-d-xo.html
    This time we are blinking 4 LEDs independently using threading. Thanks Paul for all your videos!

  • @itsmeintorrespain2714
    @itsmeintorrespain2714 2 ปีที่แล้ว

    The error is not fatal and it tells you to use GPIO.setwarnings(False) to disable it.

  • @peterkarlsson7801
    @peterkarlsson7801 2 ปีที่แล้ว

    I am legend

  • @MaxwellGu
    @MaxwellGu 8 หลายเดือนก่อน

    I folded like a cheap Publix lawn chair

  • @TheRealFrankWizza
    @TheRealFrankWizza 2 ปีที่แล้ว

    I am legend, not at making videos though. I didn't use a for loop though. I used another while loop with a counter.

  • @shahibm-v6n
    @shahibm-v6n 4 หลายเดือนก่อน

    I wrote a ditto code

  • @johnhechtlinger9465
    @johnhechtlinger9465 27 วันที่ผ่านมา

    I am almost a legend (except for the cont==Y)

  • @TheUnofficialMaker
    @TheUnofficialMaker 2 ปีที่แล้ว

    updated... th-cam.com/video/p7n0iTfqcWE/w-d-xo.html

  • @javamanjake
    @javamanjake 4 หลายเดือนก่อน

    I've been into computers since the C-64 but this has been my first attempt at python programming and interfacing with GPIO pins. Thank you for your invaluable videos, I'm having a blast!!
    Here's my finished assignment,
    th-cam.com/video/38so1YFaT6o/w-d-xo.html

  • @keneflucas937
    @keneflucas937 ปีที่แล้ว

    import RPi.GPIO as GPIO
    import time
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(11, GPIO.OUT)
    ON = True
    OFF = False
    name = input("What is your name?: ")
    print("What's up", name)
    numBlink = int(input("How many blinks do you want?: "))
    for i in range(0, numBlink):
    GPIO.output(11, ON)
    time.sleep(1)
    GPIO.output(11, OFF)
    time.sleep(1)
    GPIO.cleanup()
    The program works as it should. However, line 8....how do I put a question mark after the user's name? Everything I tried returned an error.

    • @keneflucas937
      @keneflucas937 ปีที่แล้ว

      import RPi.GPIO as GPIO
      import time
      GPIO.setmode(GPIO.BOARD)
      GPIO.setup(11, GPIO.OUT)
      ON = True
      OFF = False
      name = input("What is your name?: ")
      print("What's up", name,"?")
      numBlink = int(input("How many blinks do you want?: "))
      for i in range(0, numBlink):
      GPIO.output(11, ON)
      time.sleep(1)
      GPIO.output(11, OFF)
      time.sleep(1)
      GPIO.cleanup()
      I got it but there's a space between the name and the question mark. How do I remove that space?

  • @aman-sood
    @aman-sood 2 ปีที่แล้ว

    I am legend!
    Code: github.com/amansoo/Homework_Solutions/blob/main/raspberrypi_series/how_many_blinks.py

  • @simminator
    @simminator 2 ปีที่แล้ว

    I am legend!

  • @michaelfleming2177
    @michaelfleming2177 2 ปีที่แล้ว

    I am legend

  • @larrypaige3092
    @larrypaige3092 ปีที่แล้ว

    I am legend!

  • @FakeCarsGoingInFakeCircles
    @FakeCarsGoingInFakeCircles ปีที่แล้ว

    I am legend

  • @rayDu-er7eu
    @rayDu-er7eu 7 หลายเดือนก่อน

    I am legend