![]() |
Forum Index : Microcontroller and PC projects : lcd screen is way turn it off after no activity time
Author | Message | ||||
tenij000 Newbie ![]() Joined: 30/05/2025 Location: NetherlandsPosts: 16 |
wondering if there is a setting to make lcd panel sleep after no activity mean whill came up whit this screen saver ' PicoMite Screensaver - Bouncing Text OPTION EXPLICIT CONST scr_w = MM.HRES CONST scr_h = MM.VRES CONST text$ = "PicoMite!" CONST font = 2 CONST text_w = 8 * LEN(text$) CONST text_h = 8 * 2 ' Approximate height of font 2 DIM x = RND * (scr_w - text_w) DIM y = RND * (scr_h - text_h) DIM dx = 2, dy = 2 CLS TEXT x, y, text$, , font DO CLS TEXT x, y, text$, RGB(RND * 255, RND * 255, RND * 255), font x = x + dx y = y + dy IF x < 0 OR x > (scr_w - text_w) THEN dx = -dx IF y < 0 OR y > (scr_h - text_h) THEN dy = -dy PAUSE 30 LOOP UNTIL INKEY$ <> "" CLS PRINT "Screensaver stopped" |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7783 |
There's no actual instruction to do it, but I've used TIMER before now. Something like (very roughly, this won't run as is): timeout = 10000 'value is in milliseconds so this is 10 seconds x = timer + timeout do if TIMER < x then do the screen display else blank the screen endif loop TIMER is a counter that counts up in milliseconds for as long as the program is running. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2557 |
Similar to Mick but use the timer to turn off the backlight. Use inkey$ or touch(x) to turn it back on. eg in Mick's program backlight 0 : do while touch(x)=-1 : loop : backlight 80 'blank the screen Or if your program needs to keep doing it's thing while the backlight is off this might work:- SETPIN gp11, INTL, TouchInt 'change gp11 to your T_INT or PEN pin. Sub TouchInt backlight 80 End Sub 'main loop Do '... backlight 0 'blank the screen '... Loop Working example SetPin gp11, INTL, TouchInt 'change gp11 to your T_INT or PEN pin. Dim integer T_x, T_y, bright = 80, TimeOut = 3 'seconds Dim tmr TimeOut = TimeOut * 1000 'convert to mS Backlight bright Sub TouchInt bright = 80 Backlight bright If Touch(x)>-1 And Touch(y)>-1 Then T_x = Touch(x) 'in case you need them for anything else T_y = Touch(y) Print T_x,T_y EndIf tmr = Timer End Sub tmr = Timer ' main loop Do If Timer - tmr > TimeOut Then If bright > 1 Then Inc bright,-1 'fade the screen Backlight bright EndIf Pause 99 'replace with your program Loop Edited 2025-06-15 22:45 by phil99 |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |