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

  Рет қаралды 18,452

Paul McWhorter

Paul McWhorter

Күн бұрын

Пікірлер: 86
@chrisjowaisas95
@chrisjowaisas95 5 ай бұрын
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 жыл бұрын
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!
@jansimurda9998
@jansimurda9998 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.
@lalabali8575
@lalabali8575 2 жыл бұрын
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 жыл бұрын
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
@rockymountainfacet5958
@rockymountainfacet5958 Жыл бұрын
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.
@Lehibob
@Lehibob 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!
@fammertens9419
@fammertens9419 6 ай бұрын
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
@tpobrienjr
@tpobrienjr 2 жыл бұрын
Enjoyable! Thanks for including your mistakes. We all learn that way.
@leeg.1402
@leeg.1402 2 жыл бұрын
Thanks for the solution Paul. Have a good evening.
@Eagle621
@Eagle621 10 ай бұрын
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 10 ай бұрын
You are so welcome!
@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.
@James-ts8tc
@James-ts8tc 11 ай бұрын
I am legend. This was a fun lesson. This is exactly how I wanted to learn. Looking forward to continuing!
@paulmcwhorter
@paulmcwhorter 11 ай бұрын
LEGEND!
@JACKOFALLTODD
@JACKOFALLTODD 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.
@JoRogan-l1v
@JoRogan-l1v Жыл бұрын
I am legend. Thank you again for your excellent tuition.
@paulmcwhorter
@paulmcwhorter Жыл бұрын
LEGEND!
@alessandrorhomberg9183
@alessandrorhomberg9183 11 ай бұрын
Really good tutorial, thanks for your efforts :)
@harolddunn8395
@harolddunn8395 2 жыл бұрын
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!
@TaiTai-py2tp
@TaiTai-py2tp 5 ай бұрын
Did it on the Raspberry pi 5. Setup is a little different as you need to use gpiod library instead.
@josenoelcaraballo766
@josenoelcaraballo766 Жыл бұрын
I did it a little differently. The program stops if the user writes 0 for the number of blinks.
@James-ts8tc
@James-ts8tc 11 ай бұрын
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?
@tkklein
@tkklein 2 жыл бұрын
love your stuff!
@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!
@lorisrobots
@lorisrobots 2 жыл бұрын
I am Legend! I posted my video on Lesson 4. Thx
@anthonyjackson486
@anthonyjackson486 5 ай бұрын
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 5 ай бұрын
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.
@dillatronic4757
@dillatronic4757 2 жыл бұрын
Can you make projects on Elisa 3 Robot?
@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.
@hungry8560
@hungry8560 9 ай бұрын
I PROUDLY SAY I AM LEGEND!
@paulmcwhorter
@paulmcwhorter 9 ай бұрын
LEGEND!
@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
@Dr.AhmedQusaySabri
@Dr.AhmedQusaySabri 9 ай бұрын
Thanks a lot
@jessekloberdanz246
@jessekloberdanz246 2 жыл бұрын
fun one!
@itsmeintorrespain2714
@itsmeintorrespain2714 2 жыл бұрын
The error is not fatal and it tells you to use GPIO.setwarnings(False) to disable it.
@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()
@TheUnofficialMaker
@TheUnofficialMaker 2 жыл бұрын
You should start your own curriculum for schools but name it Genius!
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
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
@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!
@paula.jackson5463
@paula.jackson5463 2 жыл бұрын
i folded like a wallmart lawnchair......but I promise to do better. Been learning Linux hardcore and time gets away!
@MishaM73
@MishaM73 Жыл бұрын
I AM LEGEND!
@paulmcwhorter
@paulmcwhorter Жыл бұрын
LEGEND!
@keithlohmeyer
@keithlohmeyer 2 жыл бұрын
This is so fun I decided to do a second homework video kzbin.info/www/bejne/mmLKmZt_d9l6ibs This time we are blinking 4 LEDs independently using threading. Thanks Paul for all your videos!
@MrCameronMoore
@MrCameronMoore 2 жыл бұрын
I am LEGEND : - ))
@brucemilyko8549
@brucemilyko8549 Жыл бұрын
I am legend (after I fixed all my typos)
@paulmcwhorter
@paulmcwhorter Жыл бұрын
LEGEND!
@josenoelcaraballo766
@josenoelcaraballo766 Жыл бұрын
I am legend! 😁
@paulmcwhorter
@paulmcwhorter Жыл бұрын
LEGEND!
@jothieswari2112
@jothieswari2112 2 жыл бұрын
I am legend!
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
LEGEND!
@shahibm-v6n
@shahibm-v6n 3 ай бұрын
I wrote a ditto code
@trevorblanchard923
@trevorblanchard923 6 ай бұрын
I am a legend
@paulmcwhorter
@paulmcwhorter 6 ай бұрын
LEGEND!
@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.
@peterkarlsson7801
@peterkarlsson7801 2 жыл бұрын
I am legend
@MaxwellGu
@MaxwellGu 7 ай бұрын
I folded like a cheap Publix lawn chair
@javamanjake
@javamanjake 3 ай бұрын
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, kzbin.info/www/bejne/aWnWoGSPe8aHbNE
@paulmcwhorter
@paulmcwhorter 3 ай бұрын
LEGEND!
@TheUnofficialMaker
@TheUnofficialMaker 2 жыл бұрын
updated... kzbin.info/www/bejne/pmjRYZyKm9aWjac
@keneflucas937
@keneflucas937 11 ай бұрын
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 11 ай бұрын
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!
@paulmcwhorter
@paulmcwhorter 2 жыл бұрын
LEGEND!
@michaelfleming2177
@michaelfleming2177 2 жыл бұрын
I am legend
@larrypaige3092
@larrypaige3092 11 ай бұрын
I am legend!
@paulmcwhorter
@paulmcwhorter 11 ай бұрын
LEGEND!
@nottombrady6826
@nottombrady6826 Жыл бұрын
I am legend
@paulmcwhorter
@paulmcwhorter Жыл бұрын
LEGEND!
@rayDu-er7eu
@rayDu-er7eu 6 ай бұрын
I am legend
@paulmcwhorter
@paulmcwhorter 6 ай бұрын
LEGEND!
Raspberry Pi LESSON 5 : Understanding Binary Numbers
39:50
Paul McWhorter
Рет қаралды 19 М.
Raspberry Pi LESSON 4 : Understanding and Using GPIO Pins
45:45
Paul McWhorter
Рет қаралды 59 М.
The Ultimate Sausage Prank! Watch Their Reactions 😂🌭 #Unexpected
00:17
La La Life Shorts
Рет қаралды 8 МЛН
Как Я Брата ОБМАНУЛ (смешное видео, прикол, юмор, поржать)
00:59
Натурал Альбертович
Рет қаралды 4,9 МЛН
Raspberry Pi IoT Server Tutorial: InfluxDB, MQTT, Grafana, Node-RED & Docker
12:32
Learn Embedded Systems
Рет қаралды 237 М.
Raspberry Pi LESSON 5 HOMEWORK SOLUTION: Understanding Binary Numbers
1:01:47
The Raspberry Pi Pico WAS Overrated! But that changed!
10:18
GreatScott!
Рет қаралды 618 М.
Raspberry Pi Pico W: Wireless Weather Station
17:13
ExplainingComputers
Рет қаралды 296 М.
Complete Raspberry Pi Pins Overview GPIO Header
15:19
Robotics Back-End
Рет қаралды 12 М.
Unboxing the Raspberry Pi CM5 Development Kit
11:36
Level 2 Jeff
Рет қаралды 6 М.
Arduino vs Pico - Which is the Best Microcontroller For You?
20:38
Gary Explains
Рет қаралды 301 М.
The Ultimate Sausage Prank! Watch Their Reactions 😂🌭 #Unexpected
00:17
La La Life Shorts
Рет қаралды 8 МЛН