CircuitPython School - Distance Reacting Lamp / Luminaria

  Рет қаралды 1,024

Prof. John Gallaugher

Prof. John Gallaugher

Күн бұрын

IMPORTANT NOTE: There has been a change to how the library operates, so to avoid an error, after getting a distance reading like this:
distance = distance_sensor.distance
you can then set the None result to a distance of 0 (or any other value you'd like), if an infinity reading is returned. If you don't do this then you'll see that you're getting an error when there's nothing in front of the sensor:
if distance == None:
distance = 0
We show how to use the Adafruit VL53L1X Time of Flight Distance Sensor to light up LEDs on a NeoPixel strip as an object approaches, and turn off lights as the object moves away. This is a solution to a challenge presented at the end of the prior video. We also introduce several new CircuitPython commands and techniques including min, max, math.ceil, continue, and f-strings. Finally, the code we create is shown in a fun and beginner-friendly build containing a simple yet beautiful mason jar light that will light up with more lights as the user approaches. Part of Prof. John Gallaugher's CircuitPython School & his university Physical Computing course.

Пікірлер: 7
@btecx
@btecx 2 жыл бұрын
Thank you!! Love your teaching method as always
@profgallaugher
@profgallaugher 2 жыл бұрын
Thanks for taking the time to say’s so. Definitely keeps me going. Cheers!
@profgallaugher
@profgallaugher 2 жыл бұрын
The note on Raspberry Pi Pico and QT Py RP2040 should have read be sure to “import busio”, too
@natelott2911
@natelott2911 2 жыл бұрын
Mine is working great except for the strip turns on when I move out of the range of the distance sensor?
@mattkojetin8198
@mattkojetin8198 2 жыл бұрын
Excellent! Thank you!
@mrjeffsangeorge9028
@mrjeffsangeorge9028 Жыл бұрын
Hey John, My class is working on this code and we are all getting the same error and not sure what it's telling us: TypeError: Unsupported types for __lt__: 'int', 'nonetype' It seems to happen when the sensor has nothing in front of it. Throughts?
@profgallaugher
@profgallaugher Жыл бұрын
Mr. San George, it seems the library changed a bit, but after you get a distance reading: distance = distance_sensor.distance you can do this: if distance == None: distance = 0 You'll find a working copy of code I used this semester with my students in the Google Drive for Physical Computing at Gallaugher.com. Look for the file named: "Distance_Reactive_Lights.py". And if you e-mail me an address, I'll send some "Make Something Awesome" stickers for your students. Tell 'em I said "Hi" and to work hard so I can see them in my class at Boston College!
Use PyCharm with CircuitPython on Macs (takes setup, but it is glorious)
33:27
DIY Laser Image Projector (100ft+ Range!)
20:08
Ben Makes Everything
Рет қаралды 236 М.
How Strong is Tin Foil? 💪
00:26
Preston
Рет қаралды 88 МЛН
LIFEHACK😳 Rate our backpacks 1-10 😜🔥🎒
00:13
Diana Belitskay
Рет қаралды 3,3 МЛН
Motion-activated Sound Effects with Arduino, PIR Sensor & MP3 Player
25:26
【For Beginner】How to start electronics and what item is needed
18:16
The Art of Code - Dylan Beattie
1:00:49
NDC Conferences
Рет қаралды 4,7 МЛН
Motion-activated Servo Motors with Arduino and PIR Sensor
25:20
Rachel De Barros
Рет қаралды 32 М.
I Made My Own Image Sensor! (And Digital Camera)
10:55
SeanHodgins
Рет қаралды 1 МЛН
Top Fifteen Mistakes People Make When Designing Prototype PCBs
12:26
Cosplay Light and Sound
Рет қаралды 152 М.
Hide your files like a hacker (5 Ways)
19:17
NetworkChuck
Рет қаралды 107 М.
Water Your Garden with IoT - Soil Moisture Sensors
54:46
DroneBot Workshop
Рет қаралды 407 М.
No, Einstein Didn’t Solve the Biggest Problem in Physics
8:04
Sabine Hossenfelder
Рет қаралды 305 М.