Hello Ionut. Great tutorial! Really good to show others how to hardware debounce and avoid using delay. One things I will point out-- the number at the end of the fadeToBlackBy line is not a time unit (not per second), but rather a fade percentage. So in your case, using 5, means fade by 5/256th, or fade by about 1.9% each time the line is run. Using 128 would be a 50% fade each time it is called.
@IonutFedaceag4 жыл бұрын
Hi and thanks! :) I admit that i never read the manual for fadeToBlackBy , i presumed that is a time unit, judging by the result that is produced while changing it's value. Thanks for pointing it out! :)
@GennaroDurante-r1z9 ай бұрын
Your project is great. It is exactly what I want to do. The only difference is that I do not want the strip to sweep. I want to tun the whole strip red,green,blue solid respectively. switching between each color with button 1. How do you modify your code to do that?
@Electronieks3 жыл бұрын
no working link for the sketch?
@wawanirianto21303 жыл бұрын
Do you have sketch arduino nano for 2 Way ledstrip?
@مريممريومة-ف2د4 жыл бұрын
Hi I wander haw to use the signal from the car blinkers to the buttons
@octogames68232 жыл бұрын
Thank you so much! I just completed this project with a 24 rgb led ring pcb. Super silly question. How do I adjust the code to keep all LED's on with no animations?
@bkmo98595 жыл бұрын
Can you be so kind as provide a code example for triggering the hazard light section of a sketch using the original directional controls of a motorcycle? Such as a switch with left-off-right orientation. Where as one of a right-off-left-off switch selection within 3 or 4 seconds would trigger the hazard lights. Thank you. I already have a hazard controller using attiny85 triggered by a separate switch. I want it to trigger by original switch with a right left button push.
@IonutFedaceag5 жыл бұрын
I think that i understand what you need, but i need more details. Please explain with more details how the original controls work ... a clip will be nice ... and il see how i can help you.
@bkmo98595 жыл бұрын
@@IonutFedaceag There are no hazard lights on the motorcycle originally. just directionals. I have added hazard lights myself by adding 12v output of my own controller to the left and right positive feeds of the directional lights. I dont want to use an external switch to turn them on. I would like the arduino sketch to detect a quick right then left switching of the directional controls to start the hazard light sequence that feed flashing 12v via 2 mosfets to the directional lights. What I need is help with the code to detect the right-off-left-off switch inputs and run the loop for the hazards. The original control is a switch that latches the load of the flasher relay to the directional light. left-off-right if pushed right it stays on until you push center to release the switch, same for left. I want to go right-left-center to start the flasher code outputting to the mosfets.
@IonutFedaceag5 жыл бұрын
Did you run the original signal switch thru the attiny85? Because you will need them to go thru the attiny85 to be able to detect the combination of buttons and the delay for detecting the hazard combination will also be added to both turn signals. I will think of a sollution in the comming days and i will get back to you. EDIT: Please send me a link for the original switch or at least a picture of it.
@bkmo98595 жыл бұрын
@@IonutFedaceag it is like the one here: kzbin.info/www/bejne/hZOXe4p8hpuUisU it is connected to the directionals only. I will add button inputs via opto-isolators to my attiny85 flasher module
@IonutFedaceag5 жыл бұрын
If the switch latches in position, i think this should work... drive.google.com/file/d/1ZpcZ6TPaM5N17WZgP-P-ADVf2XVaeEqF/view?usp=sharing Am i right?
@alfredomolina26972 жыл бұрын
Hello, where did you learn to programming neopixel ws2812 LEDs, I would like learn it, it's awesome that you make
@IonutFedaceag Жыл бұрын
If go thru FastLed documentation fastled.io/docs/ and you know how to program in arduino, everything will be verry clear...
@JuanFunQi3 жыл бұрын
Thanks as always I learn a ton of something new more more more
@mannersmakethman36682 жыл бұрын
You are my hero!!!!!!!!
@IonutFedaceag Жыл бұрын
🤣
@martinkuliza Жыл бұрын
And then a hero comes along With the programming strength to carry on and you cast your fears aside cause you know you can survive......... ohhhhhhhhhh so when you feel like hope is gone Come to you tube when you're strong and you'll finally see the truth THAT THE PROGRAMMING SKILLS LIES IN YOU LOL
@trueindia8084 жыл бұрын
Thanks Sir, Very nice clip & step by step detail
@stevecummins3244 жыл бұрын
Easy software debouncing without delay loop.... In main loop update previous switch state, and read current switch state. If they aren't same that is potentially bouncing... Set a countdown timer to a high value. If countdown timer greater than 1...decrement timer by 1 Continue with rest of main loop Only consider a read button state valid if countdown value=0
@IonutFedaceag4 жыл бұрын
The great thing of software is that it's always better way of doing things. Yes, that can be another way of doing it, but a timer means a float and a float takes a lot o memory... so doing it in hardware, at least for me it's cheaper (in terms of memory)...
@stevecummins3244 жыл бұрын
@@IonutFedaceag Rather than a float you mean an unsigned long? 4bytes.
@IonutFedaceag4 жыл бұрын
Yes, sorry... unsigned long... last night i had a few drinks before responding to comments! :D :) Let's say for ATtiny85, 4 bytes of memory for one variable/button is to much, from my point of view. Like i said in most of my videos and in the description of this channel, i'm not a full time programmer, so I will confuse them from time to time, so sorry for that... :) ;)
@fabiolus20073 жыл бұрын
Thank You sir! Seem to work with INPUT_PULLUP eliminating resistor.
@ronitsharma79362 жыл бұрын
I was trying to implement your code into a strip of 10 less but I get an error message for "fadeToBlackBy( leds[0], COUNT, 5);" , and the error message being "cannot convert 'CRGB' to 'CRGB*' for argument '1' to 'void fadeToBlackBy(CRGB*, uint16_t, uint8_t)".
@IonutFedaceag2 жыл бұрын
I think you accidentally changed something that you shouldn't have... Download the sketch again, modify only the number of leds and test again.
@steveanimatrix38875 жыл бұрын
Good video, but it would really help if you increased your font size in your IDE when making videos so it's easier for us to read.
@IonutFedaceag5 жыл бұрын
Thanks! No problem, in future videos i will make it so. ;)
@scottiusnevious51434 жыл бұрын
So for my final project i should just solder power to the boards 5v and not from something else?
@IonutFedaceag4 жыл бұрын
Everything in this example works on 5v ! But i don't think that i quit understand your question...
@samad4193 жыл бұрын
copied the code exact and it wont change color :( Correction! after enough understanding and watching you're video a couple times I've managed to not just get it working but control multiple LED strips with one button for each one! Thank you!
@stefint43164 жыл бұрын
Hello, can you also provide link to the on/off, momentary and toggle switches you are using in your demonstrations? Thank you
@IonutFedaceag4 жыл бұрын
Hi. Do you mean the link to the sketch used in this clip? Because the link is in the description! With pleasure! ;)
@johnvargo80504 жыл бұрын
This is great information thank you. Will there be a bounce problem if powering the Arduino from the 5v power supply instead of USB?
@martinkuliza Жыл бұрын
That is completely irrelevant BOUNCE has nothing to do with power Bounce relates to the imperfection of a button's contact point and the imperfect way in which a human would press it. In a perfect world pressing a button would result in one contact of the button , Nothing more , nothing less. in the real world, a person pushes a button, they may slip, they may have water on their hands on sweat or they didn't realize they need to push harder or whatever, they have shaky hands perhaps in any case, it results in multiple contacts This has nothing to do with how you power it when using a button ASSUME THERE WILL ALWAYS BE A BOUNCE ISSUE
@jommeldockx17935 жыл бұрын
Can I know what's the best LED you've used so far?
@IonutFedaceag5 жыл бұрын
Well with the buying of the ws2812b led it's a real lottery, because officially only one company is producing this type of leds and that is worldsemi ... but in real life you really don't know, because they are not marked. Until 2015 i had real problem with finding good quality leds and the majority of leds lasted about nine to twelve months, but from the mid 2015 i settled to buy the leds from only two online shops and that was a good choice, because now i don't have any problems with the leds, the only factor's that i need to get right is the cooling and a stable power supply and the leds will last. The oldest strip has almost four years and it's still working... www.iluminat-ieftin.ro/1224/Banda-LED-RGB-PIXEL-2812-60-led-m-18W ardushop.ro/ro/electronica/331-banda-leduri-rgb-neopixels-ws2812b.html?search_query=ws2812&results=4
@pablowojat45173 жыл бұрын
no compila
@Outlabyrinth4 жыл бұрын
thanks ! really helpful could you create a fonction when 2 button are pressed ? for exemple : if button 1 and 2 = 1 that willl run a fonction lets say changing colors could you help me to write the code ? please !!
@IonutFedaceag4 жыл бұрын
With pleasure ;) Well, with the example from this clip i think you could achieve what you want... but yes, i can help you if you can't. Try it yourself and if you can't achieve it, i will make a clip on how you can use two buttons and trigger at list six functions with them.
@Outlabyrinth4 жыл бұрын
@@IonutFedaceag thanks a lot you are very kind to the community !
@IonutFedaceag4 жыл бұрын
@@Outlabyrinth With pleasure... ;)
@Elysuim3 жыл бұрын
Excellent video, I'm currently searching for how to make 2 buttons produce 2 colour modes, Button 1 = Solid RED, Button 2 = fast chasing rainbow effect. Also wonder would an Opto Isolator reduce "Bounce" or are they so fast that Hardware or Software delay will still be neccessary?
@IonutFedaceag3 жыл бұрын
Glad you like it. Even if you use an optocoupler, you still have to switch it on with a button, which will still produce "Bounce" and yes, the optocoupler is fast... From my experience, the condenser and resistor are the best choice when you really need to reduce "bounce", but for most cases, software debouncing is enough. 😉
@CallousCoder3 жыл бұрын
I am not a fan of your else if statements. A good state engine can just use if statements and a state procedure, will return the next state. A while loop with an array of function pointers where the input is the state is cleanest. Although I myself only do that if we have more than 10 or so states. Because I’m also not a fan of long if blocks.
@IonutFedaceag Жыл бұрын
Yes i feel you, it's hard to keep track of all the states and it gets messy quickly when using a lot of if statements, but this is the method i control the best and since i don't code for living, the time limited for learning... 🙃
@xcruell3 жыл бұрын
Thank you :)
@justinhawley77834 жыл бұрын
Great video! It's amazing how hard it is to find in depth learning for using tactile switches with Fastled. Do you know if there is an easy way to declare the button at the beginning of an existing sketch to switch between multiple functions? For example, say I wanted to have blue change to red indefinitely, then I push the button and it changes to orange to yellow, then push it again and get a twinkle pattern, etc? I know Tweak4all has one sketch like this, but I would like to be able to make my own basic versions with a button. Sorry if this doesn't make sense, I'm not a coder but I want to learn this stuff.
@IonutFedaceag4 жыл бұрын
Thanks! I didn't understand to well your question, but anything can be done... of course you will need to make some modification to your existing sketch to be able to take in account the changes made by the new code...
@nico45975 жыл бұрын
Hey, how do i pass the currentcolor value through for(int l = 0; l < NUM_LEDS_PER_STRIP; l++){ leds[l]=CRGB::currentColor; FastLED.show(); CRGB doesnt take these kinds of values Awesome tutorial btw
@IonutFedaceag5 жыл бұрын
Well, if you use CRGB struct (hex color type), you need to make a list of the colors that you need and run thru them. This is a color picker www.w3schools.com/colors/colors_picker.asp and lets say that this is the hex for red color #ff0000 and you will use it like this 0xff0000 . The variable type for holding the currentColor hex value can be an unsigned long . Or you can change to CHSV struct and use it like this: for(int l = 0; l < NUM_LEDS_PER_STRIP; l++){ leds[l]=CHSV(hue,saturation,brightness); FastLED.show(); } github.com/FastLED/FastLED/wiki/FastLED-HSV-Colors Thanks.
@arifrismawanto11985 жыл бұрын
Coding tanpa tombol ada ndak
@IonutFedaceag5 жыл бұрын
???
@arifrismawanto11985 жыл бұрын
@@IonutFedaceag sketch without buttons there or not
@IonutFedaceag5 жыл бұрын
If you want the sketch without buttons, just replace this line in the sketch leds[0][pos] += CHSV( currentColor, 255, currentBrt); with leds[0][pos] += CHSV( 0, 255, 255); and ignor the rest (buttons and other code)... To set your color and intensity, just change the three values parentheses with values from 0 to 255 ... the order is (color, saturation, brightness).
@PESCADATRETA3 жыл бұрын
GOOD VIDEO mate you deserve more views and subs! thank you for this awsome explanation! increase the font size for the videos ;)
@vipalsharma4120 Жыл бұрын
Hopeless
@IonutFedaceag Жыл бұрын
Why is that ?
@wawanirianto21303 жыл бұрын
Do you have sketch arduino nano for 2 Way ledstrip?