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.
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!
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
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
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.
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!
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.
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
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
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.
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.
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!
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
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.
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.
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!
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.
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()
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()
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()
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!
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
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.
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?
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.
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!
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
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
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.
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!
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.
Enjoyable! Thanks for including your mistakes. We all learn that way.
Thanks for the solution Paul. Have a good evening.
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
I am legend.
This was a fun lesson. This is exactly how I wanted to learn. Looking forward to continuing!
LEGEND!
Really good tutorial, thanks for your efforts :)
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
You are so welcome!
I am legend. Thank you again for your excellent tuition.
LEGEND!
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.
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.
love your stuff!
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!
I am Legend! I posted my video on Lesson 4. Thx
Did it on the Raspberry pi 5. Setup is a little different as you need to use gpiod library instead.
I did it a little differently. The program stops if the user writes 0 for the number of blinks.
This was my solution too!
Paul, in the future can you take time out to comment on the flora & fauna in the background?
Thanks a lot
fun one!
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
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.
I PROUDLY SAY I AM LEGEND!
LEGEND!
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?
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.
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!
Can you make projects on Elisa 3 Robot?
You should start your own curriculum for schools but name it Genius!
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.
@@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
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()
Thanks for posting your code. I always learn by looking at how others code a problem.
@@keithlohmeyer I had a typo in line 7
I am legend! 😁
LEGEND!
I AM LEGEND!
LEGEND!
I am LEGEND : - ))
Your link for the corrected file does not work.
Thank you Larry, I just fixed it. Appreciate the note.
@@paulmcwhorter You are very welcome, others will be happy!
I am legend (after I fixed all my typos)
LEGEND!
i folded like a wallmart lawnchair......but I promise to do better. Been learning Linux hardcore and time gets away!
I am legend!
LEGEND!
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()
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()
I am a legend
LEGEND!
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!
The error is not fatal and it tells you to use GPIO.setwarnings(False) to disable it.
I am legend
I folded like a cheap Publix lawn chair
I am legend, not at making videos though. I didn't use a for loop though. I used another while loop with a counter.
I wrote a ditto code
I am almost a legend (except for the cont==Y)
updated... th-cam.com/video/p7n0iTfqcWE/w-d-xo.html
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
LEGEND!
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.
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?
I am legend!
Code: github.com/amansoo/Homework_Solutions/blob/main/raspberrypi_series/how_many_blinks.py
I am legend!
LEGEND!
I am legend
I am legend!
LEGEND!
I am legend
LEGEND!
I am legend
LEGEND!