Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 17:59 21 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Backlight Spinbox on MM+ 2.8" ILI9341

Author Message
Mickanical
Newbie

Joined: 21/11/2018
Location: Australia
Posts: 2
Posted: 10:39am 07 Nov 2022
Copy link to clipboard 
Print this post

Hi Guys

I've updating an old Micromite backpack Sprinkler Control program to work on a MM+ backpack. Trying to make it look better.

I'm stuck on a Spinbox to control the backlight like Geoffs Pump control demo program.

I did the obvious thing... copying the relevant bits of code and massaging it to work on a smaller screen. Some bits of code only work with the SSD1963. Cannot remember which. I've learn't a fair bit going to and fro with the manual but no joy yet.

So I have the Spinbox code below. could you suggest where I've gone wrong please.


Thank you
Michael


'SPINBOX TESTING ON MM PLUS Backpack with 2.8" LCD

option explicit


dim integer TS_BRIGHT

TS_BRIGHT=51

CLS
GUI Interrupt TouchDown

PWM 2,100,TS_BRIGHT '  

'PAGES SETUP
GUI SETUP 1 'PAGE 1 SETUP


GUI Caption #1, "Backlight", 22, 100, ,RGB(200,200,255),0

pause 1000  ' delay to help see whats going on

GUI Spinbox TS_BRIGHT, 10, 150, 200, 50,,,2, 2, 100
'CtrlVal(TS_BRIGHT) = 100

Do : Loop


Sub TouchDown
TEXT 10,10,STR$(ts_bright),LM,1,2,RGB(BLACK),RGB(GREEN)'Shows the value changing or not
'Case TS_BRIGHT ' the brightness spin box
'BackLight CtrlVal(TS_BRIGHT)
PWM 2,100,TS_bright
'END SELECT
End Sub

 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10628
Posted: 12:26pm 07 Nov 2022
Copy link to clipboard 
Print this post

The backlight command only works with the SSD1963 display and will give an error with any other type of display

void cmd_backlight(void) {
   if(HRes != 0 && Option.DISPLAY_TYPE > SSD_PANEL) error("SSD1963 display only");
   SetBacklightSSD1963(getint(cmdline, 0, 100));
}


However, this shouldn't be an issue. Just use a PWM pin to connect to the backlight pin on the display and change the PWM duty cycle in your code where you are currently using the BACKLIGHT command
Edited 2022-11-07 22:26 by matherp
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025