I have a rotary encoder mapped to give me two additional function layers using Control Mappers FN input.
using the Ncalc formula. getcontrollerbuttonstate(‘0xc872,0x200b, 4)
I can get the associated led to blink when I turn the rotary in that direction, and if I replace the 4 with 5. I get a result for the turning the rotary in the other direction.
i am trying to add a static on/off light to the assigned led, ie one click for On, one click for off but all I am getting is a short blink.
what I am missing?
Ensure that you are maintaining the state of the LED (on/off) between clicks. You might need a variable to keep track of whether the LED should be on or off. if (getcontrollerbuttonstate('0xc872,0x200b, 4') == 1) {
// Toggle the state
ledState = !ledState; // Assuming ledState is a boolean variable
setLedState(ledState); // Function to set LED state
}
Rotary encoders can produce multiple signals for a single turn due to bouncing. Implement a debounce mechanism to ignore rapid signals and only register a change every few milliseconds.
@waylonwesley thank you for the help i will give that a try later on today.