FearTheDentist
November 4th, 2005, 10:54 AM
I'm making a page to control the tuner on my receiver- it's pretty straigtforward except I want to have a slider control that can set the frequency. The problem I've run into is FM frequencies all end in an odd number ie 97.1 97.3 etc. When adjusting through that range the slider sends 971 972 973..etc .to G4. The even #'s are not recognized by the receiver and just generate unneccesary traffic that tends to clog up the serial connection.
So- is there a way I can tell the slider to only send odd #'s? Alternatively, I could do some "post processing" of the slider values in Lua to toss out any even numbers- I was thinking something like (round(value\2) x 2) + 1 What would the simplest way be to do this in Lua?
BTW I know it would probably be simpler to tune the frequency with a keypad, but I'm trying to keep the # of buttons down to an absolute minimum.
Thanks!
So- is there a way I can tell the slider to only send odd #'s? Alternatively, I could do some "post processing" of the slider values in Lua to toss out any even numbers- I was thinking something like (round(value\2) x 2) + 1 What would the simplest way be to do this in Lua?
BTW I know it would probably be simpler to tune the frequency with a keypad, but I'm trying to keep the # of buttons down to an absolute minimum.
Thanks!