Skip to content
This repository was archived by the owner on Aug 27, 2021. It is now read-only.
JBtje edited this page Jun 4, 2015 · 1 revision

Syntax

TIMER <0-3>, <timeout in milliseconds> [REPEAT] GOSUB <line number>

TIMER <0-3> STOP

Description

It's often useful to run bit of your program either at a particular time in the future, or repeatedly every so many miliseconds. This can be done using TIMERS. The BlueBasic parser currently supports 4 timers <0-3>. Each timer can be created to run a specific section of the Basic program after a given number of milliseconds has elapsed. A timer may choose to keep repeating (e.g. execute every 5 seconds) or just run once (e.g. execute after 5 seconds and then stop).

Example

10 TIMER 1, 2000 REPEAT GOSUB 1020
...
1020 PRINT "Hello"
1030 RETURN

The above example sets up timer 1. Every 2000 milliseconds, repeatedly, it will run the subroutine at line 1020. This line simply prints "Hello" and then finishes. The timer can be stopped by executing:

TIMER 1 STOP

Clone this wiki locally