android-notify
android-notify
Synopsis
Generates an Android notification
Usage
(android-notify message)
Returns
message
Where
-
message is string: the message to notify.
Description
Generates an Android notification with the given text message.
Examples
(android-notify "Hello world!")
"Hello world!"
audio-pwm
audio-pwm
Synopsis
Generates a PWM signal through the audio output.
Usage
(audio-pwm volume period left_pulse right_pulse)
Returns
null
Where
-
volume is number[0..1]: the audio volume. A value in the range 0-100. By default, volume is 0.
-
period is number[0..1]: the period of the signal in milliseconds.
-
left_pulse is number[0..1]: the left pulse duration in milliseconds (less than period).
-
right_pulse is number[0..1]: the right pulse duration in milliseconds (less than period).
Description
This function generates a PWM (pulse width modulation) signal with the specified parameters throught the audio output. The signal is interrupted when volume is 0.
Examples
(audio-pwm 100 16 1.5 1.6)
null
beep
beep
Synopsis
Plays a beep sound.
Usage
(beep volume)
Returns
null
Where
-
volume is number[0..1]: the audio volume. A value in the range 0-100. By default, volume is 50.
Description
Plays a beep sound with the specified volume. This functions blocks until the sound stops.
Examples
gps
gps
Synopsis
Gets the GPS location.
Usage
(gps operation listener)
Returns
null
Where
-
operation is string: the operation to execute: "register" or "unregister".
-
listener is function[0..1]: the listener function that will be invoked every time that GPS location is updated. It will receive a list as argument that contains this information: (provider timestamp latitude longitude altitude speed accuracy).
Description
This function accepts 2 operations: "register": registers the listener function that will process the location updates (only one listener per module is allowed), "unregister": removes the previous location listener.
Examples
(gps "register" (function (l) (set location l)))
"registered"
(gps "unregister")
"unregistered"
sensor
sensor
Synopsis
Reads the sensors of the device.
Usage
(sensor operation type listener)
Returns
null
Where
-
operation is string: the operation to execute: "register", "unregister", "listeners" or "types".
-
type is string[0..1]: The type of sensor to read for "register" and "unregister" operations. The sensor type can be one of the following: "accelerometer", "magnetic", "gyroscope", "light", "pressure", "proximity", "gravity", "rotation", "humidity" or "temperature".
-
listener is function[0..1]: the listener function that will be invoked every time the value of the sensor changes. It will receive a list as argument that contains this information: (type_of_sensor timestamp sensor_data ... sensor_data).
Description
This function accepts 4 operations: "types": returns a list that contains all the available types of sensor. "register": registers the listener function that will process the values for the given type of sensor. "unregister": removes the previous registered listener for the given type of sensor.
Examples
(do
(sensor
"register"
"accelerometer"
(function (d) (set accelerometer d))
)
(sleep 1000)
accelerometer
)
(
"type" => "accelerometer"
"timestamp" => 1509649001135
"x" => 0
"y" => 0.1
"z" => 0.9
)
(sensor "unregister" "accelerometer")
null
(sensor "types")
("accelerometer" "light" "magnetic" "gyroscope")
speaker
speaker
Synopsis
Enables or disables the speaker sound.
Usage
(speaker state)
Returns
result
Where
-
state is boolean[0..1]: true to enable the speaker or false to disable it.
-
result is boolean: the current speaker state.
Description
When state is true the speaker is enabled whatever headphones are connected or not. When it is false, the speaker is disabled. If state argument is not specified this function returns the current speaker state.
Examples
tts
tts
Synopsis
Converts text to speech.
Usage
(tts
text
"volume" => volume
"language" => language
)
Returns
result
Where
-
text is string: the text to be synthesized.
-
volume is number[0..1]: the audio volume. A value in the range 0-100. By default, the volume is 50.
-
language is string[0..1]: the language in which to synthesize the text. An ISO 639 alpha-2 or alpha-3 language code. If omitted, the language of the default locale is used.
-
result is string: the text that was synthesized.
Description
Converts the given text to speech with the specified volume. This functions blocks until the text is synthesized.
Examples
(tts "Hello world")
"Hello world"
(tts "My name is John" "volume" => 20)
"My name is John"
(tts "Hola mundo" "language" => "es")
"Hola mundo"
vibrate
vibrate
Synopsis
Makes the device vibrate.
Usage
(vibrate millis)
Returns
null
Where
-
millis is number[0..1]: the duration of vibration in milliseconds. By default, millis is 1000.
Description
Makes the device vibrate for the specified milliseconds.
Examples