new Buzz(ondata)
A class to manage connections to the Neosensory Buzz
Parameters:
Name | Type | Description |
---|---|---|
ondata |
callback | Callback function to handle app logic |
Methods
(static) acceptTerms()
Accept developer terms of the Neosensory Developer API License (https://neosensory.com/legal/dev-terms-service) after calling requestAuthorization(). Successfully calling
this unlocks the following commands: audio start, audio stop, motors_clear_queue, motors start,
motors_stop, motors vibrate.
(static) battery()
Request the current battery level from the device.
(static) clearMotorQueue()
Clear any vibration commands sitting the device’s motor FIFO queue. This should be called prior
to streaming control frames using vibrateMotors. Requires users to requestAuthorization() and acceptTerms().
(static) connect()
Setup BLE interface.
(static) disableMotors()
Clear the motors command queue and shut down the motor drivers. Requires users to requestAuthorization() and acceptTerms().
(static) disconnect()
Disconnect the device.
(static) enableMotors()
Initialize and start the motors interface. The motors can then accept motors vibrate commands. Requires users to requestAuthorization() and acceptTerms().
(static) getLEDs()
Read the current RGB and intensity calues of the device's LEDs. Requires users to requestAuthorization() and acceptTerms().
(static) getLRA()
This command allows you to read the current LRA vibration mode. Requires users to requestAuthorization() and acceptTerms().
(static) getThreshold()
Return the current vibrateMotors() command queue configuration. Requires users to requestAuthorization() and acceptTerms().
(static) info()
Obtain device and firmware information.
(static) parseResponse(response)
Parse JSON response from the device.
Parameters:
Name | Type | Description |
---|---|---|
response |
utf8 | UTF-8 byte array. |
(static) pauseDeviceAlgorithm()
Pause the default Neosensory algorithm on the device to accept developer commands. Requires users to requestAuthorization() and acceptTerms().
(static) requestAuthorization()
Request developer authorization (https://neosensory.com/legal/dev-terms-service)
(static) resumeDeviceAlgorithm()
Restart the default Neosensory algorithm. Requires users to requestAuthorization() and acceptTerms().
(static) sendCommand()
A function to encode command strings and send to the device
(static) setButton(feedback, sensitivity)
Set button response and sensitivity. Requires users to requestAuthorization() and acceptTerms().
Parameters:
Name | Type | Description |
---|---|---|
feedback |
boolean | Allow the device to send a response when any button is pressed. |
sensitivity |
boolean | Allow sensitivity changes to the microphone. |
(static) setLEDs(colors, intensities)
Control the color and intensity of the device's 3 LEDs. Requires users to requestAuthorization() and acceptTerms().
Parameters:
Name | Type | Description |
---|---|---|
colors |
array | Three nested arrays each containing the rgb values (0-255) for an LED. |
intensities |
array | An array of length 3 containing the LED intensity (0-50). |
Example
buzz.setLEDS([[255,0,0],[0,255,0],[0,0,255]],[50,50,50])
(static) setLRA()
This command sets the LRA operation mode. This setting is not persistent, and will reset to the default (open loop) if the band is reset. Requires users to requestAuthorization() and acceptTerms().
(static) setThreshold(feedbackType, threshold)
Configure how the device responds to the vibrateMotors() command. Requires users to requestAuthorization() and acceptTerms().
Parameters:
Name | Type | Description |
---|---|---|
feedbackType |
string | Integer between 0-2. 0 = Default; 1 = Always Respond; 2 = Threshold Response. |
threshold |
float | Float between 0 - 64. |
(static) startAudio()
Starts the device’s microphone audio acquisition. Requires users to requestAuthorization() and acceptTerms().
(static) stopAudio()
Stops the device’s microphone audio acquisition. Requires users to requestAuthorization() and acceptTerms().
(static) vibrateMotors(controlFrames)
Set the actuators amplitudes on a connected Neosensory device. Requires users to requestAuthorization() and acceptTerms().
Parameters:
Name | Type | Description |
---|---|---|
controlFrames |
array | Nested arrays with a length matching the number of motors of the target device (Buzz: 4). Element values should between 0 and 255. |
Example
buzz.vibrateMotors([[155,0,0,0]])