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 : Blink GUI Led.
Author | Message | ||||
Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1664 |
Might be one for Geoff, Blinking GUI Leds in different colours - That parts easy. But returning to a constant "Non-Illuminated colour seems difficult. It appears the colour cannot be issued while the led is illuminated & knowing when it's not is unknown. [Code] GUI LED L_Led1,"",30,449,30,RGB(Yellow) CtrlVal(L_Led1)=500 Pause 1000 FCOLOUR RGB(Red),Led1 CtrlVal(L_Led1)=500 Pause 1000 FCOLOUR RGB(Red),Led1 CtrlVal(L_Led1)=500 FCOLOUR RGB(Yellow),Led1 'Doesn't work untested [/code] Thinking out loud a bit here.... Phil. |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9082 |
You could do it via a sub that deleted the old reference, and created a new one, like: SUB CHANGELED(REF,CAPTION$,X,Y,R,C) GUI DELETE REF GUI LED REF,CAPTION$,X,Y,R,RGB(C) END SUB Untested, but that SHOULD work. I thought you could make a flashing LED a plain one again by just setting it's value to zero(off) or one(on), and any number GREATER then 1 would be the flash delay as you have in your example above..... IE: Set the colour to what you want, then set that LED's CtrlVal to zero to turn it off, but show the dim background colour you wanted it to be. Are you saying that does not work? Smoke makes things work. When the smoke gets out, it stops! |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3167 |
I'm not sure what the problem is. When the GUI LED goes off it is a dull version of its former colour, Do you want it to change to a dull version of a different colour? Geoff Geoff Graham - http://geoffg.net |
||||
Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1664 |
Sorry, Wanted to test a little before replying. Yes it's the dimmed colour I'm trying to maintain constant. But when using a LED in the Flashing mode, the only way to do this is to code somehow to reset the FCOLOUR after the timeout has expired. What I was wondering with this snippet, [code]FCOLOUR RGB(Red),Led1 CtrlVal(L_Led1)=500 FCOLOUR RGB(Yellow),Led1[/code] is whether it would flash red for the 500ms, the extinguish to yellow. Tested it now; and it just displays a yellow led.(Maybe red for an undetectable moment). Somewhere in code I could check the CtrlVal of the led & see if it's zero & do the Fcolour change based on that, but would be a lot of looping. Mostly it got me thinking on the lines of "What if someone wants to do multi-colour flashing Leds, how do you best maintain a static inactive colour. Nothing broken really, all works as expected. Phil. |
||||
GoodToGo! Senior Member Joined: 23/04/2017 Location: AustraliaPosts: 188 |
Hey Phil, Would changing the GUI LED forecolour to RGB(black) better suit your application? GTG! ...... Don't worry mate, it'll be GoodToGo! |
||||
Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1664 |
Grey, Black either would look authentic. It's more a case of when or how to chang it when using a CtrlVal that makes it flash. Would seem impractical to be repeatedly testing if the CtrlVal has gone to zero before change the FCOLOUR value again. Phil. |
||||
Print this page |