-
Notifications
You must be signed in to change notification settings - Fork 7
Timer predicates
Tushar Semwal edited this page Oct 18, 2017
·
5 revisions
The commands are mentioned below:
-
delay(t): Used to apply a delay of t milliseconds.
- t: Time in milliseconds.
-
delayMicroseconds(t): Used to apply a delay of t microseconds.
- t: Time in microseconds.
-
millis(T): It returns a number (T) representing the number of milliseconds since the program called one of the AgPi functions. It returns an unsigned 32-bit number which wraps after 49 days.
- T: Time in milliseconds returned by the function.
-
micros(T): It returns a number representing the number of microseconds since the program called one of the AgPi functions. It returns an unsigned 32-bit number which wraps after approximately 71 minutes.
- T: Time in microseconds returned by the function.
Example for LED blinking:
- Commect a LED to Raspberry Pi at GPIO pins 1 (HIGH) and 0 (LOW).
- Write the following code in a prolog file(in the working directory).
Blink_Led - Now start prolog with sudo permission(very important):
$ sudo swipl
- Consult the
platform_pi.pl
using:?- consult('platform_pi.pl').
This will load all of the Tartarus predicates. - Execute the command:
?- start_peripherals.
- Execute the following command to see the LED blink and the output of millis command on terminal.
?- start.