Documentation ¶
Overview ¶
Package to interact with various sensor modules.
A sensor module is a device that measures one or more aspects of the physical world (temperature, humidity, etc.).
Index ¶
- type Angle
- type DLPTH1C
- func (d *DLPTH1C) Close() error
- func (d *DLPTH1C) ConfirmConnection(maxPingCount int) error
- func (d *DLPTH1C) GetBroadbandSound() (SoundLevel, error)
- func (d *DLPTH1C) GetHumidity() (Humidity, error)
- func (d *DLPTH1C) GetLight() (LightLevel, error)
- func (d *DLPTH1C) GetPressure() (Pressure, error)
- func (d *DLPTH1C) GetSound() (Frequencies, error)
- func (d *DLPTH1C) GetTemperature() (Temperature, error)
- func (d *DLPTH1C) GetTilt() (Tilt, error)
- func (d *DLPTH1C) GetVibrationX() (Frequencies, error)
- func (d *DLPTH1C) GetVibrationY() (Frequencies, error)
- func (d *DLPTH1C) GetVibrationZ() (Frequencies, error)
- func (d *DLPTH1C) Ping() error
- type Frequencies
- type Frequency
- type Humidity
- type LightLevel
- type Peak
- type Pressure
- type SoundLevel
- type Temperature
- type Tilt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DLPTH1C ¶
type DLPTH1C struct {
// contains filtered or unexported fields
}
DLPTH1C represents an open serial connection to a DLP-TH1C sensor device.
Additional sensor information available at http://www.dlpdesign.com/usb/th1c.php
func NewDLPTH1C ¶
NewDLPTH1C opens a serial connection to a DLP-TH1C sensor device and return a sensor object for device interaction.
func (*DLPTH1C) ConfirmConnection ¶
ConfirmConnection will confirm a good connection to the device by performing up to a specified maximum number of pings. If all fail, the error returned by the final call to Ping() will be returned.
func (*DLPTH1C) GetBroadbandSound ¶
func (d *DLPTH1C) GetBroadbandSound() (SoundLevel, error)
GetBroadbandSound returns the broadband ambient sound level.
func (*DLPTH1C) GetHumidity ¶
GetHumidity retrieves the current humidity value.
func (*DLPTH1C) GetLight ¶
func (d *DLPTH1C) GetLight() (LightLevel, error)
GetLight returns the ambient light level.
func (*DLPTH1C) GetPressure ¶
GetPressure retrieves the current pressure value.
func (*DLPTH1C) GetSound ¶
func (d *DLPTH1C) GetSound() (Frequencies, error)
GetSound returns the fundamental (peak-amplitude) frequency of ambient sound and five lower-amplitude peaks.
func (*DLPTH1C) GetTemperature ¶
func (d *DLPTH1C) GetTemperature() (Temperature, error)
GetTemperature retrieves the current temperature value.
func (*DLPTH1C) GetVibrationX ¶
func (d *DLPTH1C) GetVibrationX() (Frequencies, error)
GetVibrationX retrieve the X-axis fundamental (peak-amplitude) frequency of vibration and five lower-amplitude peaks.
func (*DLPTH1C) GetVibrationY ¶
func (d *DLPTH1C) GetVibrationY() (Frequencies, error)
GetVibrationY retrieve the Y-axis fundamental (peak-amplitude) frequency of vibration and five lower-amplitude peaks.
func (*DLPTH1C) GetVibrationZ ¶
func (d *DLPTH1C) GetVibrationZ() (Frequencies, error)
GetVibrationZ retrieve the Z-axis fundamental (peak-amplitude) frequency of vibration and five lower-amplitude peaks.
func (*DLPTH1C) Ping ¶
Ping the connected device and verify response.
Note: a device that is disconnected before its response value has been fully read may still have one byte in its internal response buffer. The first ping may fail in this case. It may be necessary to ping more than once to reset the device to a known state ready to receive new commands. ConfirmConnection can be used to perform multiple pings.
type Frequencies ¶
Frequencies stores a fundamental and five subharmonic peaks.
Note that lower-amplitude peaks can be above or below the fundamental. The response is always a single fundamental followed by five peaks as per https://www.dlpdesign.com/DLP-TH1C-DS-V10.pdf?page=6.
func (Frequencies) String ¶
func (f Frequencies) String() string
type Humidity ¶
type Humidity float32
Humidity represents the humidity (%RH). Value range: 0.0 → 100.0.
type LightLevel ¶
type LightLevel float32
LightLevel represents the ambient light level (unitless). Value range: 0.0 → 1.0.
func (LightLevel) String ¶
func (l LightLevel) String() string
type Peak ¶
type Peak struct { Freq Frequency Amplitude SoundLevel }
Peak stores a frequency and amplitude of sound measured.
type SoundLevel ¶
type SoundLevel float32
SoundLevel represents the sound level or amplitude (dB).
func (SoundLevel) String ¶
func (s SoundLevel) String() string
type Temperature ¶
type Temperature float32
Temperature represents the temperature (°C).
func (Temperature) String ¶
func (t Temperature) String() string