Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:56 08 Jul 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 : Flashing a LED.

Author Message
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 01:00pm 19 Aug 2016
Copy link to clipboard 
Print this post

Ok,

Not quite going back to basics, I know how to flash one in a manner that takes time out...

[Code]Pin(Led1)=1 : Pause 200 : Pin(Led1)[/code]

Or to do it without the Pause holding up stuff you could use

[Code]Pulse Led1,200[/code]

But what about with Advanced Graphics.

[Code]GUI LED #ref, caption$, CenterX, CenterY, Radius, Colour[/code]

I want 2 LEDS for Coms acknowledgment; would be good if they could stay on for 1/2 a second.

Any suggestions?

Thanks

Phil.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6269
Posted: 02:40pm 19 Aug 2016
Copy link to clipboard 
Print this post

Your first version using PAUSE will PAUSE your program for the on time.

PULSE will run in the background.
  Quote  A pulse of 3 mS or more will run in the background. Up to five different
and concurrent pulses can be running in the background and each can
have its time changed by issuing a new PULSE command or it can be
terminated by issuing a PULSE command with zero for 'width'.


This makes it the best choice if you want the main program to keep running.

I tend to turn the led on and then, later in the program, turn it off.
If you turn it on at the start of a routine and of at the end, you have a visual indication of the time the routine is taking. This can be handy.

Jim

VK7JH
MMedit
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 02:55pm 19 Aug 2016
Copy link to clipboard 
Print this post

Thanks Jim,

It's the GUI LED I'm trying to pulse.

At the moment I's inverting it very time coms is received from a device.

Tried on at the beginning & off at the end of the coms routines, but it happens too fast.

At the moment Coms are polling every 2 seconds, so it the GUI LED doesn't get stuck either on or off for a long period it gives a debug indication that coms is happening.

What's happening at the moment is the Master alternatively polls either the heat pump or the spa every 2 seconds, alternating between them.

Cheers

Phil.
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 05:15pm 19 Aug 2016
Copy link to clipboard 
Print this post

You can use a timer with interrupt.

Microblocks. Build with logic.
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2932
Posted: 11:09pm 19 Aug 2016
Copy link to clipboard 
Print this post

Hi Phil,

Can you turn the GUI LED on when required, and at the same time set a SETTICK. Then when the SETTICK 'expires' simply switch of the GUI LED (and disable the SETTICK).

This allows program to keep running with only the single triggering of the SETTICK 'disturbing' your main program.

WW
 
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