I'm getting serial data from my digital piano and that data arduino uses to control the leds I have 2m/144 strip.
My issue is that when I use the if statement in the loop the leds noticeable flicker with each more note being held. If I use while instead of if that issue is gone but then I have the leds being lit when the notes are not held if I hold more than 3 notes at the time and with if that doesn't happenes but flickering does.
You have two if in the loop. Which is issue?
The first one if (Serial.available() > 0 {
}
If I change the if to while it works fine but leds are being held even tho my keys are not held thats the case with more than 3 keys being held if I play more those leds light up and are getting held even if i let go. It goes back to normal if 3 notes are being held no more than that. That doesn't happen with if at the beginning of the loop but then my leds flicker if I play more than one key...
I think the problem is that the Arduino code does not know when you stop pressing the note, so it does not know when to turn the led off.
I don't think this can be fixed by changing the Arduino code. The code sending the bytes may need to change also.
It tells the LEDs to go black immediately, not when you stop pressing the note.
Does your digital piano have a MIDI output? If it does, that is the usual way to control LEDs like this. The MIDI signals will tell the Arduino when a note is pressed and when a note is released.
I think that you forget to add FastLED.show(); at the end of this code:
I want to use it on my pc too so I can't directly connect the arduino to midi output from the piano. So I have to use serial data and control leds like that
I will try my arudino is not opening the port luckily on a laptop it still works. Getting the IDE from the site not from the windows store...
I don't know much about MIDI, but I am beginning to think I may know more than you do.
Programmable LED strip flickering = Power supply issue.
Post a schematic and an image of your project.
I was able to fix my issue. It was just bad code and I had to figure what went wrong.