From the course: Raspberry Pi Weekly

Connect input to output: Range finder to LED - Raspberry Pi Tutorial

From the course: Raspberry Pi Weekly

Connect input to output: Range finder to LED

- Last week, we connected two LEDs to the Raspberry Pi. This week, I'm going to show you how to connect that project to a range finder to control the color of the RGB LED. Hi, I'm Mark Niemann-Ross, and welcome to this week's edition of Raspberry Pi Weekly. Every week, we explore the Raspberry Pi and share useful tips. Now, this project is simpler than you might think. We've already done both projects before. We're just going to connect the two of them together, and it's useful to learn how to connect inputs and outputs. Start with the project we created last week. It has two LEDs connected to the Raspberry Pi. Connect an HC-SRO4 range finder to the Raspberry Pi identically as we did in the previous ranger finder project. You may have to move some connectors around to make room. Boot up your Raspberry Pi. Then run the code from the range finder project to test the range finder, and run the code from last week to test the LEDs. If all the connections work as expected, we're ready to move onto some code that shows how to connect the range finder to the LEDs. The code for this week tests the LEDs, then the range finder and then demonstrates the connection. The value from the range finder is shown in the shell and is fed to green channel of the RGB LED. When you get close to the range finder, the single LED will start to pulse rapidly. Play with the controls and the values a bit to see how this changes. Thanks for joining me for this episode of Raspberry Pi Weekly. Be sure to join the LinkedIn group and check out previous episodes on LinkedIn Learning. I'll see you next week with more Raspberry Pi adventures.

Contents