All pastes #403846 Raw Edit

Stuff

public text v1 · immutable
·published 2007-03-20 17:52 UTC
rendered paste body
level=0

while should_run() do

    -- lock requested values
    lock_requested_values()

    -- if user pressed UP button
    if get_requested_value( variables.up ) then
        if(level < 100) then
            level=level+1
        end
    end

    -- if user pressed DOWN button
    if get_requested_value( variables.down ) then
        if(level > 0) then
            level=level-1
        end
    end

    -- send to lintouch the new level
    set_real_value( variables.level, level )

   -- clean dirty flag on requested values
   sync_requested_values()
   unlock_requested_values()

   -- sync results back to the user
   sync_real_values()

   sleep( 0.01 * 1000 * 1000 )

end