Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 22:53 03 Feb 2026 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 : Micromite Question

Author Message
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 1021
Posted: 05:10am 02 Feb 2026
Copy link to clipboard 
Print this post

Is there a procedure to start a LED flashing (Pulse a PIN) when the program is at an INPUT prompt and restore the LED when the INPUT prompt is satisfied?

OA47
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5656
Posted: 05:57am 02 Feb 2026
Copy link to clipboard 
Print this post

Hi oa,

Write a small SUB. that toggles the  LED pin.

Just before the input statement set a time interrupt with SETTICK pointing to that SUB.
After the input, use SETTICK,0,0 to stop the blinking.
Then a PIN() = x to restore the old led state.

Volhout
Edited 2026-02-02 15:59 by Volhout
PicomiteVGA PETSCII ROBOTS
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 1021
Posted: 12:50am 03 Feb 2026
Copy link to clipboard 
Print this post

Volhout, unfortunately this is a very old Maximite project and according to the manual

  Quote  Interrupts can occur at any time but they are disabled during the execution of INPUT statements.


I will have to work another way.

OA47
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3340
Posted: 01:55am 03 Feb 2026
Copy link to clipboard 
Print this post

The best way around this issue is to use non blocking INPUT$() and some logic to get the input data, then you could do as Volhout suggested.  I did have a function to do that but I'm overseas and cannot find it, perhaps someone else can help.

Geoff
Edited 2026-02-03 11:56 by Geoffg
Geoff Graham - http://geoffg.net
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5656
Posted: 08:12am 03 Feb 2026
Copy link to clipboard 
Print this post

Hi OA47,

This could do it, the LED blinks until <ENTER> is typed on the keyboard.
'blink led while waiting for input

'prepare LED for blinking
SetPin 2,dout   'LED connected to pin 2
Pin(2)=1        'LED ON


'input routine ----------------------------------------------------------

SetTick 200,blink 'blink period = 2*200ms = 400ms
answer$=""
Do
 If Loc(0) Then                 'are there characters in input buffer
   answer$=answer$+Input$(1,0)  'read one character from input buffer
 EndIf
Loop Until Right$(answer$,1)=Chr$(13) 'did we hit return ?
SetTick 0,0

'end input routine ------------------------------------------------------

Print answer$
Pin(2)=1        'Resore LED condition

End


Sub blink
 Pin(2)=1-Pin(2) 'toggle LED pin
End Sub


Tested on micromite MKII

Volhout
Edited 2026-02-03 18:26 by Volhout
PicomiteVGA PETSCII ROBOTS
 
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 2026