This Should (untested as of yet) work...
One thing about programming... there is always more than one way to do the exact same thing... some are more elegant than others... Mine usually falls into the "less elegant, but gets the job done" category
The extra "IF" test should eliminate the need to test for below zero or the "max 0" test.
Code:volume = 100 'set a default level step = 3 'This could be ANY NUMBER FROM 1 TO 9 main: if buttonA then volume = (volume + step) min 350 'this works fine to limit the top end to 350 if buttonB and (volume < 3) then volume = 0 goto Skip1 endif if buttonB then volume= (volume - step) 'but of course THIS fails, because it's hard to go lower than zero Skip1: LCDOUT $fe, $c0, dec volume pause 50 goto main end





Bookmarks