uses the SerialPort to get and parse four channels of data from the brainwave device via bluetooth.
see http://www.kuwatec.co.jp/Products/ibva/
open port and start reading data from the sensor.
port |
a String with the name of the serial port. by default this is |
action |
a Function that is evaluated each time new sensor data arrives. the arguments passed in are four 10-bit integers (0-1023). by default this function is set to just post data. |
rate |
sampling rate in Hertz (an Integer 1-2000). can also be set/get with the methods below. |
cutoff |
filter cutoff frequency ratio to sampling rate (a Float 0.1 to 1.0). can also be set/get with the methods below. |
the SerialPort object in use.
a Function that is evaluated when sensor data is received. the argument passed in is four Integers between 0 and 1023. by default this function is set to just post the data.
an Array with the last received sensor data. as long as nothing is received this is [-1, -1, -1, -1]
.
last read sampling rate.
last read filter cutoff ratio.
quark version.
a Boolean that can be get or set.
send a request to the device for the current battery voltage. calls -blAction when received.
send a request to the device for the name of the device. calls -dnAction when received.
send a request to the device for the current sampling rate. calls -srAction when received.
send a request to the device for the current filter cutoff ratio. calls -frAction when received.
update rate in Hertz (1-2000).
filter cutoff ratio (0.1-1.0).
a Function that is evaluated when data is lost or overflow. the argument passed in is an Integer. by default this function is set to just post the number of missing samples.
a Function that is evaluated when a reply from a -getBatteryLevel method is called (callback). the argument passed in is a Float between 0 and 16 in Volts. by default this function is set to just post the voltage.
a Function that is evaluated when a reply from a -getDeviceName method is called (callback). the argument passed in is a String. by default this function is set to just post the name.
a Function that is evaluated when a reply from a -getSamplingRate method is called (callback). the argument passed in is an Integer between 1 and 2000. by default this function is set to just post the sampling rate.
a Function that is evaluated when a reply from a -getFilterCutoff method is called (callback). the argument passed in is a Float between 0.1 and 1. by default this function is set to just post the filter cutoff ratio.
stops main loop and closes the serial port.