Control Different LEDs with a Joystick and Arduino

preview_player
Показать описание
Welcome to Part 2 of my Arduino Joystick series! In this tutorial, I'll show you how to wire an analog joystick to an Arduino Uno and write a sketch to control LEDs based on joystick movements. You'll learn how to use the ADC (Analog-to-Digital Converter) values from the joystick to dynamically adjust the brightness of LEDs.

Whether you're interested in lighting effects or interactive projects, understanding joystick input for LED control is essential. Join me as we explore practical applications and expand your Arduino skills. Stay tuned for more advanced joystick techniques in upcoming videos!

PART 2: You're watching it!

▶︎▶︎ Subscribe for Arduino Tutorials & Projects Delivered to Your Inbox
- Crystal-clear wiring diagrams
- Copy-paste ready code
- Pro tips for troubleshooting
- Code packs to inspire epic builds

▶︎▶︎ JOIN my Engineering Artists Discord Community
- Live Workshops
- Arduino Project Build & Code-alongs
- Small Group Office Hours
- Personalized Project Support

🛒 BUILD YOUR OWN Arduino Joystick Project:

🎬 VIDEO CHAPTERS: How to Control LEDs with a Joystick and Arduino
0:00 Welcome
0:26 How to Wire a Joystick to Arduino
1:26 How to Wire LEDs to Arduino
2:57 Arduino Code: Control LED Brightness with Joystick Movements
15:01 Testing the Arduino Sketch with the Joystick
16:09 Arduino Code: map() Function Adjustments
18:27 Testing the map() Function Adjustments
18:59 Arduino Code: Defining a Joystick Idle Deadspot
21:06 Testing the final Arduino Sketch
21:38 Wrap Up: Controlling Components with a Joystick
21:43 Join my Community for Live Events & Code!

💬 Have any questions or want to share your own experiences, tips and advice about using joysticks for controlling LEDs with Arduino? Drop a comment below – I love hearing from you!

🔔 If you find this video helpful, please hit that like button 👍 and consider subscribing to my channel for more Arduino/props/robot tutorials, tips, and tricks. Your support helps me create more content like this!

Some links included here are to affiliate sites. If you purchase something through them, I may earn a small commission — which costs you nothing! I am very grateful for your support when you use my links to make a purchase.

#arduino #arduinoproject #arduinotutorial #joystick #joystickmodule #arduinocode #leds #arduinoleds
Рекомендации по теме
Комментарии
Автор

I am a 65year old starter with Arduino and love the way you explain things. Thank you Rachel.

RJHElias
Автор

I'm loving your tutorials. I've been coding since the 80s (starting as an IBM systems programmer) but am a total Arduino noob. Your tutorials have been really helpful in getting up to speed.

A fun enhancement would be to add a separate calibrate button. When pushed with the joystick centered, it would read the neutral X and Y values, shove them into variables, add a "fudge factor" and then use those rather than hard coding. You know what they say, "Software is never finished; at some point, it's just abandoned." lol

karlsangree
Автор

Excellent work. I have been following along and decided to actually try it in real life. (having some issues)

I wrote out the code once and it worked perfectly, no glitches. My joystick was steady. I then tried adding a dead spot to the centre, just to get practice writing code, and that's when things all went wrong.

First, the LEDs starting having glitches after adding a dead spot. I checked and rechecked this several times trying to make sense of it, but couldn't. Finally, after messing with the code for a while, I ended up getting errors about parentheses. After working my way through that, trying to see what I had messed up, I started getting "expected unqualified-id before 'if'" ...

I decided that I could use the practice, and started all over from scratch. For this next part, keep in mind that I have almost NO IDEA what I'm doing. As I was working through the video, bit by bit, trying to keep up, I noticed at 12:00 in the video, when you start using the if statement, the parentheses that was in line 38 appears to move to line 40, and then at 12:12, there is a new parentheses at the end of the if statement highlighted as matching the parentheses in line 41.

I'm not sure if I'm just not understanding the code, or if this was an error that was edited out, of if there is some other explanation. It probably doesn't help that it is 3am and I have been messing with this particular problem for at least 3 hours and tinkering with it for about 9 hours straight.

EDIT: Figured it out. Not sure if this is correct, but I added parentheses at the very end, that appeared to be doubled up (but "obviously not) and it all works again.

JoelArseneaultYouTube
Автор

Nice vídeo and a nice way to introduce Hysteresis in a pratical way.

amandioreal
Автор

Fun to see that you were able to adjust the negative action from canceling out the antiative reaction?

louiepauda
Автор

A pretty and smart teacher. 🤷 Thank you Rachel. 🎉

qzorn
Автор

Hi Rachel, nice to see you.. hope all is good

truthtobehonest
Автор

This is soo cool! love they way teach miss Rachel. Thanks for clearing my doubts.

nightrideryt
Автор

Allways nice videos, i'll try this one also, keep them coming!

kurtdeschepper
Автор

Wires, lights, and knobs... oh my!
this was 😞as much fun as movie night! 🎦🍿

DBB-KEDUO
Автор

Thank You for the tutorial videos. Your just too cool!

clifc
Автор

I followed your tutorial meticulously and it failed because the LEDs didn't light up. But then I found out about LEDs having a positive and negative end to them 🤣 This took me like 2 hours to figure out 💀😂 It now works as intended ♥

cacklegag
Автор

Wow i was just planning this on my puppet alien animatronic, you ready my mind, dont do that, my wife says its chaotic, 9 projects going at the same time, big huge projects. Love the channel playing in background when in workshop, like Adam Savage your voice is good for concentration.

ZenHulk
Автор

I know how this is going to sound, but, it is what it is. I love what youre doing. Im a polymath artist/engineer. And as such, I know what its like having projects all over the place that I am working on. I just subscribed, so im not sure full extent of your skills. With that being said, I could only imagine what you would do with a 3D printer and you were able to print your own parts. So, if you were to get 1, Id be able to help you. How? Well, Im a Maya expert and I am capable of printing anything with no limitations with 100% accuracy. So, basically, theres nothing you could think of, that I wouldnt be able to figure out how to print. Im going to be making a series of tutorials that incorporate everything (check my page) from game dev, 3D art, Geometry, 3D printing, engineering etc. Youre already helping me by doing what your doing. So, I figure if there was anything I could do to help you, I would, especially if it meant seeing what you would do with something 3d printed. For example, Im going to start working on a RC Dirt buggie, that transforms into a drone and flys. LOL. And Im going to document it from start to finish. Anytime I get to something that i feel you can explain better, which would be most things when it comes to electric, Im going to direct them to your page. Sorry for the long comment but if you actually check my page youll see im legit. Also, Theres something I havent figured out, maybe it would be a dope video for you to do. I know how to code it in Unreal, but, how would you go about zeroing out numbers to work from a scale of 0-1.

For Example, In UE I would code it like this, if defualt value for X is 489, -489 and set X. X now has a value of of zero, then set max to 1000 and divide to give me 0-1. And do the same but for negative in the other direction, so the controls should technically be for accuracy 0 at defualt, -X = -1 and X =1. So .5 would be halfway moving the stick to either side. I can do this in UE but if I could it in the Arduino it would be better for me. I guess I should I mention, the RC Buggie that transforms into a drone, is going to have a VR component so itll be like youre really small driving in VR like a video game, but instead of a video game environment, itll be a real environment.. Thanks, if you took the time to read, and I apologize again for the long comment. Cheers from NYC.

PixlmechStudios
Автор

Rachel I have an interesting question, perhaps would love to see a video demonstration if you don't already have one (I didn't see one).
I'm learning a lot about my arduino from your videos, THANKS!
My question is: I plan to use my arduino to control leds on a costume and for ease of access I want the wires in the costume to have disconnects and stuff. So for a "finalization" of a project do I permanently solder wires to my board ( I have the r3 mega 2560 version with the preattached ports for all the pins) or am I supposed to solder to my jumper wires from a kit I bought and unplug from my board directly? I hope that question made sense. Thanks again for your videos!

jaycanvas
Автор

Just started using sketches. I show no line numbers . Can they be turned on?

rogerlabbee
Автор

I was just wondering what is wrong with my code. I uploaded it and the only 2 LEDs that work are the yellow and green and those ones don't even work based off of their actually positions on the joystick. I have to move up for the yellow led to work while I have to move left for the green one to turn on. any recommendations?

EmmettSobieralski
Автор

Hi, is it possible to use the button function to trigger a seperate led ring in connection to the direction of joystick movement. Eg the red if pressed while joystick pushed to the top would trigger an extra red led above the original. Am trying to make a starfury model with 12 leds as thrusters

jamesstallard
Автор

Hey Rachel been awhile, I have been playing with a CNC using Cad and writing with GCode but is itself a c++ sketch file same for Arduino ? anyway good to see you love the bangs nice look take care. 😀

jimfrozen
Автор

Will it be possible for you to make a video on PH calibration on Arduino with detail. It will help me on my project.

AmitKumarSaha-ti
visit shbcf.ru