Clamps Dictionary
open-ssensor-port
Function
(open-ssensor-port id serial-port &key (start-receiver t))
Register a new serial-sensor-port struct on serial-port, open its input, define and start its default responders if start-receiver is t. id is used for the internal registry.
Returns the id.
Arguments
id |
Keyword or Symbol denoting the id of the serial port. |
serial-port |
String denoting the device path of the serial port. |
:start-receiver |
Boolean indicating whether to start the receiver. |
Example
;; after connecting a serial sensor physically to /dev/ttyACMC0 (open-ssensor-port :ssensor-1 "/dev/ttyACM0") ;; add the sensor sending an id of 1 to the device connected to the ;; port above to the serial-sensor infrastructure (add-ssensor 1 :ssensor-1) ;; move the sensor and read values: ;; mean value of accelerometer (acc 1) ;; value of gyrometer y (gyro-x) ;; attaching actions to received data: (defparameter *unwatch* nil) (progn (unwatch-all *unwatch*) (add-watch *unwatch* (msg :warn "acc received: ~a" (acc 1))))