|
Forum Index : Microcontroller and PC projects : Micromite Question
| Author | Message | ||||
| OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 1021 |
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: NetherlandsPosts: 5656 |
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: AustraliaPosts: 1021 |
Volhout, unfortunately this is a very old Maximite project and according to the manual I will have to work another way. OA47 |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3340 |
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: NetherlandsPosts: 5656 |
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 |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |