Documentation ¶
Overview ¶
bmw280 reads sensor data from Bosh BME280 sensor. taken from https://github.com/quhar/bme280
Package dev ...
ADS1015 is the driver for ADS1015 module. https://wenku.baidu.com/view/308f9a69a9114431b90d6c85ec3a87c240288aa7
connect to raspberry pi: - VCC: pin 1 or any 3.3v pin - GND: pin 9 or and GND pin - SDA: pin 3 (SDA) - SCL: pin 5 (SCL)
Jumper: - remove jumpers on P4 & P5, keep the jumper on P6
Config Your Pi:
- $ sudo apt-get install -y python-smbus
- $ sudo apt-get install -y i2c-tools
- $ sudo raspi-config
- -> [5 interface options] -> [p5 i2c] ->[yes] -> [ok]
- $ sudo reboot now
- check: $ sudo i2cdetect -y 1 it works if you saw following message: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Package dev ...
Connect to Pi:
- vcc: any 3.3v pin
- gnd: any gnd pin
- out: any data pin
Package dev ...
Connect to Pi:
- vcc: any v3.3 pin
- gnd: and gnd pin
- i/o: any data pin
Package dev ...
Connect to Pi:
- vcc: any 3.3v or v5 pin
- gnd: any gnd pin
- out: any data pin
Package dev ...
DHT11 is an sensor for getting temperature and humidity. config:
- sudo vim /boot/config.txt
- add following line to the end of config.txt -------------------------- dtoverlay=dht11,gpiopin=4 --------------------------
- connect dht11 to raspberry pi: SIGNAL: must connect to pin 7(gpio 4) GND: any gnd pin VCC: any 3.3v pin
-----------------------------------------------------------------------
+-------------+ | | | DHT11 | | | +-+----+----+-+ | | | S | VCC | - | | | | | | +-----------+ | +----|--------------+ * 1 2 o | | | | * 3 o | | | | o o | +---------|--------------+ * 7 o | +--------------+ * 9 o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o 39 40 o | +-----------+
-----------------------------------------------------------------------
Package dev ... DS18B20 is a tempeture sensor.
Config Your Pi:
- $ sudo vim /boot/config.txt
- add following line at the end of the file ~~~~~~~~~~~~~~~~~~~~~~~~~~~ dtoverlay=w1-gpio,gpiopin=4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
- $ sudo reboot now
- check: $ cat /sys/bus/w1/devices/28-d8baf71d64ff/w1_slave should saw: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ca 01 55 00 7f ff 0c 10 bf : crc=bf YES ca 01 55 00 7f ff 0c 10 bf t=28625 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connect to Pi:
- vcc: any 3.3v pin
- gnd: any gnd pin
- dat: must connect to pin 7(gpio 4)
Package dev ...
Connect to Pi:
- vcc: any 3.3v or v5 pin
- gnd: any gnd pin
- out: any data pin
Package dev ...
GPS is the driver of NEO-M6 module.
Config Your Pi:
- $ sudo raspi-config -> [P5 interface] -> P6 Serial: disable -> [no] -> [yes]
- $ sudo vim /boot/config.txt add following two lines: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ enable_uart=1 dtoverlay=pi3-miniuart-bt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- $ sudo reboot now
- $ sudo cat /dev/ttyAMA0 should see somethings output
Connect NEO-6M GPS Sensor to Raspberry Pi:
- VCC: any 5v pin
- GND: any gnd pin
- RXT: must connect to pin 8(gpio 14) (TXD)
- TXD: must connect to pin 10(gpio 15) (RXD)
-----------------------------------------------------------------------
+-----------------+ | GPS | | NEO-M6 | | | +--+---+---+---+--+ | | | | GND TXD RXD VCC +-----------+ | | | | | o 1 2 * +---------|---|---|---+ | o o | | | | | 8 6 * +---------+ | | | o 8 * |-------------|---+ | o 10 * +-------------+ | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o 39 40 o | +-----------+
-----------------------------------------------------------------------
Package dev ...
GY25 is the driver of GY25, an angle sensor which can be used to detect yaw, pitch and roll angle.
Config Your Pi:
- $ sudo vim /boot/config.txt add following new line: ~~~~~~~~~~~~~~~~~ enable_uart=1 ~~~~~~~~~~~~~~~~~
- $ sudo vim /boot/cmdline.txt remove following contexts: ~~~~~~~~~~~~~~~~~~~~~~~~~~ console=serial0,115200 ~~~~~~~~~~~~~~~~~~~~~~~~~~
- $ sudo reboot now
- $ sudo cat /dev/ttyAMA0 should see somethings output
Connect to Pi:
- VCC: any 5v pin
- GND: any gnd pin
- TXD: must connect to pin 10(gpio 15) (RXD)
- RXT: must connect to pin 8(gpio 14) (TXD)
Package dev ...
HC-SR04 is an ultrasonic distance meter which can measure the distance to the an object like a box.
Spec:
- power supply: +5V DC
- range: 2 - 450cm
- resolution: 0.3cm ___________________________ | | | HC-SR04 | | | |___________________________| | | | | vcc trig echo gnd
Connect to Pi:
- vcc: any 5v pin
- trig: any data pin for triggering(input)
- echo: any data pin for echoing(output)
- gnd: any gnd pin
Package dev ...
Connect to Pi:
- vcc: any 3.3v pin
- gnd: any gnd pin
- out: any data pin
Package dev ...
Connect to Pi:
- +V5: any 5v
- GND: any gnd pin
- SM : any data pin
- Rx: PCF8591->AIN0
- Ry: PCF8591->AIN1
Package dev ...
L298N is an motor driver which can be used to control the direction and speed of DC motors.
Spec:
_________________________________________ | | | | OUT1 -| L298N |- OUT3 OUT2 -| |- OUT4 | | |_________________________________________| | | | | | | | | | 12v GND 5V EN1 IN1 IN2 IN3 IN4 EN2
Pins:
OUT1: dc motor A+
OUT2: dc motor A-
OUT3: dc motor B+
OUT4: dc motor B-
IN1: input 1 for motor A
IN2: input 2 for motor A
IN3: input 3 for motor B
IN4: input 1 for motor B
EN1: enable pin for motor A
EN2: enable pin for motor B
Package dev ...
LC12S is wireless transceiver module. https://world.taobao.com/item/594554513623.htm
Config Your Pi:
- $ sudo vim /boot/config.txt add following new line: ~~~~~~~~~~~~~~~~~ enable_uart=1 ~~~~~~~~~~~~~~~~~
- $ sudo vim /boot/cmdline.txt remove following contexts: ~~~~~~~~~~~~~~~~~~~~~~~~~~ console=serial0,115200 ~~~~~~~~~~~~~~~~~~~~~~~~~~
- $ sudo reboot now
- $ sudo cat /dev/ttyAMA0 should see somethings output
Connect to Pi:
- VCC: any 3.3v
- GND: any gnd pin
- CS: any data pin. high-level: sleep, low-level: work
- TX: must connect to pin 10(gpio 15) (RXD)
- RX: must connect to pin 8(gpio 14) (TXD)
Package dev ...
Connect to Pi:
- positive(the longer pin): any data pin
- negative(she shorter pin): any gnd pin
Package dev ...
LedDisplay let you display text on an led digital module which bases on the 74HC595 dirver. Please note that I only test it on a 4-bit led digital module. Andy Only following chars were supported. The any char which didn't be spported will be displayed as '-'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0 1 2 3 4 5 6 7 8 9 A B C D E F H I J L O P R S U Y Z a b c d h i j l o p q s t u y . - _ = (and blank char ' ') ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connect to Pi:
- VCC: any v3.3 pin
- GND: any gnd pin
- DIO: any data pin
- SCLK: any data pin
- RCLK: any data pin
Package dev ...
mpu6050 is the driver of mpu6050 module.
connect to raspberry pi: VCC: pin 1 or any 3.3v pin GND: pin 9 or and GND pin SDA: pin 3 (SDA) SCL: pin 5 (SCL)
Config Your Pi:
- $ sudo apt-get install -y python-smbus
- $ sudo apt-get install -y i2c-tools
- $ sudo raspi-config
- -> [5 interface options] -> [p5 i2c] ->[yes] -> [ok]
- $ sudo reboot now
- check: $ sudo i2cdetect -y 1 it works if you saw following message: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Package dev ...
OLED is the driver of an oled screen. Please NOTE that current version only supports the oled module with ssd1306 driver.
connect to raspberry pi: VCC: pin 1 or any 3.3v pin GND: pin 9 or and GND pin SDA: pin 3 (SDA) SCL: pin 5 (SCL)
+--------------------+ | OLED | | | +--+----+----+----+--+ | | | | GND VCC SCL SDA | | | | | | | | | | | | +-----------+ | +----|----|------------+ * 1 2 o | | | +------------| * 3 o | | +-----------------+ * 5 o | | | o o | +---------------------------+ * 9 o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o o | | o 39 40 o | +-----------+
Config Your Pi:
- $ sudo apt-get install -y python-smbus
- $ sudo apt-get install -y i2c-tools
- $ sudo raspi-config
- -> [5 interface options] -> [p5 i2c] ->[yes] -> [ok]
- $ sudo reboot now
- check: $ sudo i2cdetect -y 1 it works if you saw following message: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Package dev ...
PCF8591 is the driver of PCF8591 module.
connect to raspberry pi: - VCC: pin 1 or any 3.3v pin - GND: pin 9 or and GND pin - SDA: pin 3 (SDA) - SCL: pin 5 (SCL)
Jumper: - remove jumpers on P4 & P5, keep the jumper on P6
Config Your Pi:
- $ sudo apt-get install -y python-smbus
- $ sudo apt-get install -y i2c-tools
- $ sudo raspi-config
- -> [5 interface options] -> [p5 i2c] ->[yes] -> [ok]
- $ sudo reboot now
- check: $ sudo i2cdetect -y 1 it works if you saw following message: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Package dev ...
PMS7003 is the driver of PMS7003, an air quality sensor which can be used to detect PM2.5 and PM10.
Config Your Pi:
- $ sudo vim /boot/config.txt add following new line: ~~~~~~~~~~~~~~~~~ enable_uart=1 ~~~~~~~~~~~~~~~~~
- $ sudo vim /boot/cmdline.txt remove following contexts: ~~~~~~~~~~~~~~~~~~~~~~~~~~ console=serial0,115200 ~~~~~~~~~~~~~~~~~~~~~~~~~~
- $ sudo reboot now
- $ sudo cat /dev/ttyAMA0 should see somethings output
Connect to Pi:
- VCC: any 5v pin
- GND: any gnd pin
- TXD: must connect to pin 10(gpio 15) (RXD)
- RXT: must connect to pin 8(gpio 14) (TXD)
Package dev ...
Connect to Pi:
- vcc: any 5v pin
- gnd: any gnd pin
- in: pin 26(gpio 7) or any data pin
- on: the outside device
- com: the bettery
Package dev ...
Connect to Pi:
- +v: any v3.3 or 5v pin
- gnd: any gnd pin
- d0: any data pin
- d1: any data pin
- d2: any data pin
- d3: any data pin
- vt: null
Package dev ... SG90 is the driver of servo motor
Connect to Pi:
- the red line: any 5v pin
- the brown line: any gnd pin
- the yellow line: any pwn pin(must be one of gpio 12, 13, 18, 19)
Package dev ...
Connect to Pi:
- S: any data pin
- M: 5v
- -: any ground
Package dev ...
Connect to Pi:
- vcc: any 5v pin
- gnd: any gnd pin
- in1: any data pin
- in2: any data pin
- in3: any data pin
- in4: any data pin
Package dev ...
SW-420 is an sensor which is able to detect shaking.
Connect to Pi:
- vcc: any 3.3v pin
- gnd: any gnd pin
- do : any data pin
Package dev ...
US-100 is an ultrasonic distance meter, which can measure the distance to the an object like a box. US-100 works in both modes of UART and Electrical Level. This program uses UART mode to drive the module.
Config Your Pi:
- $ sudo vim /boot/config.txt add following new line: ~~~~~~~~~~~~~~~~~ enable_uart=1 ~~~~~~~~~~~~~~~~~
- $ sudo vim /boot/cmdline.txt remove following contexts: ~~~~~~~~~~~~~~~~~~~~~~~~~~ console=serial0,115200 ~~~~~~~~~~~~~~~~~~~~~~~~~~
- $ sudo reboot now
- $ sudo cat /dev/ttyAMA0 should see somethings output
Connect to Pi:
- VCC: any 3.3v or 5v pin
- GND: any gnd pin
- ...............................................
- !!! NOTE: TX->TXD, RX-RXD, NOT TX->RXD, RX-TXD
- ...............................................
- Trig/TX: must connect to pin 8(gpio 14) (TXD)
- Echo/RX: must connect to pin 10(gpio 15) (RXD)
Package dev ...
ZE08CH2O is the driver of ZE08CH2O, an air quality sensor which can be used to detect PM2.5 and PM10.
Config Your Pi:
- $ sudo vim /boot/config.txt add following new line: ~~~~~~~~~~~~~~~~~ enable_uart=1 ~~~~~~~~~~~~~~~~~
- $ sudo vim /boot/cmdline.txt remove following contexts: ~~~~~~~~~~~~~~~~~~~~~~~~~~ console=serial0,115200 ~~~~~~~~~~~~~~~~~~~~~~~~~~
- $ sudo reboot now
- $ sudo cat /dev/ttyAMA0 should see somethings output
Connect to Pi:
- VCC: any 5v pin
- GND: any gnd pin
- TXD: must connect to pin 10(gpio 15) (RXD)
Index ¶
- Constants
- Variables
- func NewSevenColorLed(pin uint) *sevenColorLed
- func NewTapModule(pinNumber uint8) *tap
- type ADS1015
- type BME280
- func (b *BME280) EnvData() (temp, press, hum float64, err error)
- func (b *BME280) Hum() (float64, error)
- func (b *BME280) Init() error
- func (b *BME280) Press() (float64, error)
- func (b *BME280) RawData() (temp, press, hum int32, err error)
- func (b *BME280) SetPressUnit(unit int)
- func (b *BME280) SetTempUnit(unit int)
- func (b *BME280) Temp() (float64, error)
- type Button
- type Buzzer
- type Camera
- type Collision
- type ComMode
- type DHT11
- type DS18B20
- type DistMeter
- type Encoder
- type GPS
- type GY25
- type GY25Mode
- type HCSR04
- type Infrared
- type Joystick
- type KY026
- type L298N
- type LC12S
- type Laser
- type Led
- type LedDisplay
- type MPU6050
- type MockGPS
- type OLED
- type Option
- type PCF8591
- type PMS7003
- type RGBLED
- type RX480E4
- type Relay
- type SG90
- type SW420
- type ShockSensor
- type StepMotor
- type US100
- type US100Config
- type VoiceDetector
- type ZE08CH2O
Constants ¶
const ( T1 byte = 0x88 + iota*2 T2 T3 P1 P2 P3 P4 P5 P6 P7 P8 P9 H1 byte = 0xA1 H2 byte = 0xE1 H3 byte = 0xE3 H4 byte = 0xE4 H5 byte = 0xE5 H6 byte = 0xE7 )
Compensation registers addresses.
const ( TempCompAddr byte = 0x88 PressCompAddr byte = 0x8E H1CompAddr byte = 0xA1 H2CompAddr byte = 0xE1 )
const ( HumAddr byte = 0xFD TempAddr byte = 0xFA PressAddr byte = 0xF7 DataAddr byte = 0xF7 )
Data registers addresses.
const ( IDAddr byte = 0xD0 ResetAddr byte = 0xE0 CtrlHumAddr byte = 0xF2 StatusAddr byte = 0xF3 CtrlMeasAddr byte = 0xF4 ConfigAddr byte = 0xF5 )
Other registers addresses.
const ( // I2CAddr is default BME280 I2C address. I2CAddr int = 0x77 // ResetVal is a value which when written to ResetAddr resets the sensor. ResetVal byte = 0xB6 // IDVal is a ID value of the sensor. IDVal byte = 0x60 )
General constants.
const ( OverSmpl1 byte OverSmpl2 OverSmpl4 OverSmpl8 OverSmpl16 )
Oversampling constants.
const ( SleepMode byte = 0x00 ForcedMode byte = 0x01 NormalMode byte = 0x03 )
Modes of operation.
const ( FilterOff byte = iota << 2 Filter2 Filter4 Filter8 Filter16 )
Filter settins
const ( // Standby for 0.5 ms. Stndby05 byte = iota << 5 // Standby for 62.5 ms. Stndby625 // Standby for 125 ms. Stndby125 // Standby for 250 ms. Stndby250 // Standby for 500 ms. Stndby500 // Standby for 1000 ms. Stbdby1000 // Standby for 10 ms. Stndby10 // Standby for 20 ms. Stndby20 )
Normal mode standby modes.
const ( Celsius = iota Fahrenheit Kelvin )
Available temperature units.
const ( HPa = iota Bar PSI )
Available pressure units.
const ( // ConversionRegiserPointer ... ConversionRegiserPointer byte = 0x00 // ConfigRegiserPointer ... ConfigRegiserPointer byte = 0x01 //LoThreshRegiserPointer ... LoThreshRegiserPointer byte = 0x10 // HiThreshRegiserPointer ... HiThreshRegiserPointer byte = 0x11 // ComparatorQueueAssertAfterOne Assert after one conversion ComparatorQueueAssertAfterOne uint16 = 0x0000 // ComparatorQueueAssertAfterTwo Assert after two conversions ComparatorQueueAssertAfterTwo uint16 = 0x0001 // ComparatorQueueAssertAfterFour Assert after four conversions ComparatorQueueAssertAfterFour uint16 = 0x0002 // ComparatorQueueDisable Disable comparator and set ALERT/RDY pin to high-impedance (default) ComparatorQueueDisable uint16 = 0x0003 // LatchingComparatorLatching The ALERT/RDY pin does not latch when asserted (default) LatchingComparatorLatching uint16 = 0x0000 // LatchingComparatorNonLatching The asserted ALERT/RDY pin remains latched until LatchingComparatorNonLatching uint16 = 0x0004 // ComparatorPolarityActiveLow This bit controls the polarity of the ALERT/RDY pin (default) ComparatorPolarityActiveLow uint16 = 0x0000 // ComparatorPolarityActiveHigh This bit controls the polarity of the ALERT/RDY pin ComparatorPolarityActiveHigh uint16 = 0x0008 // ComparatorModeTraditional this bit configures the comparator operating mode. (default) ComparatorModeTraditional uint16 = 0x0000 // ComparatorModeWindow this bit configures the comparator operating mode. ComparatorModeWindow uint16 = 0x0010 // DataRate128 control the data rate setting. 128 Sample Per Seconds DataRate128 uint16 = 0x0000 // DataRate250 control the data rate setting. 250 Sample Per Seconds DataRate250 uint16 = 0x0020 // DataRate490 control the data rate setting. 490 Sample Per Seconds DataRate490 uint16 = 0x0040 // DataRate920 control the data rate setting. 64 Sample Per Seconds DataRate920 uint16 = 0x0060 // DataRate1600 control the data rate setting. 128 Sample Per Seconds DataRate1600 uint16 = 0x0080 // DataRate2400 control the data rate setting. 250 Sample Per Seconds DataRate2400 uint16 = 0x00A0 // DataRate3300_0 control the data rate setting. 475 Sample Per Seconds DataRate3300_0 uint16 = 0x00C0 // DataRate3300_1 control the data rate setting. 475 Sample Per Seconds DataRate3300_1 uint16 = 0x00E0 // DeviceOperationModeContinous Continuous-conversion mode DeviceOperationModeContinous uint16 = 0x0000 // DeviceOperationModeSingleShot Single-shot mode or power-down state DeviceOperationModeSingleShot uint16 = 0x0100 // ProgramableGainAmplifier6144 These bits set the FSR of the programmable gain amplifier. For voltages in the range ±6.144 ProgramableGainAmplifier6144 uint16 = 0x0000 // ProgramableGainAmplifier4096 set the FSR of the programmable gain amplifier. For voltages in the range ±4.096 ProgramableGainAmplifier4096 uint16 = 0x0200 // ProgramableGainAmplifier2048 set the FSR of the programmable gain amplifier. For voltages in the range ±2.048 ProgramableGainAmplifier2048 uint16 = 0x0400 // ProgramableGainAmplifier1024 set the FSR of the programmable gain amplifier. For voltages in the range ±1.024 ProgramableGainAmplifier1024 uint16 = 0x0600 // ProgramableGainAmplifier0512 set the FSR of the programmable gain amplifier. For voltages in the range ±0.512 ProgramableGainAmplifier0512 uint16 = 0x0800 // ProgramableGainAmplifier0256_0 set the FSR of the programmable gain amplifier. For voltages in the range ±0.256 ProgramableGainAmplifier0256_0 uint16 = 0x0A00 // ProgramableGainAmplifier0256_1 set the FSR of the programmable gain amplifier. For voltages in the range ±0.256 ProgramableGainAmplifier0256_1 uint16 = 0x0C00 // ProgramableGainAmplifier0256_2 set the FSR of the programmable gain amplifier. For voltages in the range ±0.256 ProgramableGainAmplifier0256_2 uint16 = 0x0E00 // MultiplexerConfigurationAIN0 AINP = AIN0 and AINN = GND MultiplexerConfigurationAIN0 uint16 = 0x4000 // MultiplexerConfigurationAIN1 AINP = AIN1 and AINN = GND MultiplexerConfigurationAIN1 uint16 = 0x5000 // MultiplexerConfigurationAIN2 AIN2 = AIN2 and AINN = GND MultiplexerConfigurationAIN2 uint16 = 0x6000 // MultiplexerConfigurationAIN3 AIN3 = AIN3 and AINN = GND MultiplexerConfigurationAIN3 uint16 = 0x7000 )
Variables ¶
var ( // GY25QueryMode ... GY25QueryMode = GY25Mode{0xA5, 0x51} // GY25AutoMode ... GY25AutoMode = GY25Mode{0xA5, 0x52} // GY25AutoTextMode ... GY25AutoTextMode = GY25Mode{0xA5, 0x53} // GY25CorrectionPitchAndRollMode ... GY25CorrectionPitchAndRollMode = GY25Mode{0xA5, 0x54} // GY25CorrectionYawMode ... GY25CorrectionYawMode = GY25Mode{0xA5 + 0x55} )
Functions ¶
func NewSevenColorLed ¶
func NewSevenColorLed(pin uint) *sevenColorLed
func NewTapModule ¶
func NewTapModule(pinNumber uint8) *tap
Types ¶
type BME280 ¶
type BME280 struct {
// contains filtered or unexported fields
}
BME280 is an object representing BME280 sensor.
func New ¶
New returns new BME280 object. New object has following default values: mode = ForcedMode tempOverSmpl = 16 pressOverSmpl = 16 humOverSmpl = 16 filter = off standby = 500ms Temperature units Celsius Presure units hPa
func (*BME280) SetPressUnit ¶
SetPressUnit sets pressure unit.
func (*BME280) SetTempUnit ¶
SetTempUnit sets temperature unit.
type Buzzer ¶
type Buzzer struct {
// contains filtered or unexported fields
}
Buzzer ...
type Camera ¶
type Camera struct { }
Camera ...
func (*Camera) TakePhoto ¶
TakePhoto take a photo using motion service. in default, the created photo file will be in folder: /var/lib/motion you can change the directory in the config of motion. the config file is in /etc/motion/motion.conf and you need to change the 'snapshot_filename' to 'lastsnap.jpg' after changing, this will be look like: ----------------------------------------- target_dir /var/lib/motion snapshot_filename lastsnap.jpg -----------------------------------------
type DS18B20 ¶
type DS18B20 struct { }
DS18B20 ...
func (*DS18B20) GetTemperature ¶
GetTemperature ... temperature file: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ca 01 55 00 7f ff 0c 10 bf : crc=bf YES ca 01 55 00 7f ff 0c 10 bf t=28625 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^~~~~~~~~
type GY25 ¶
type GY25 struct {
// contains filtered or unexported fields
}
GY25 ...
func (*GY25) IncludedAngle ¶
IncludedAngle ...
type Laser ¶
type Laser struct {
// contains filtered or unexported fields
}
Laser ...
type Led ¶
type Led struct {
// contains filtered or unexported fields
}
Led ...
type LedDisplay ¶
type LedDisplay struct {
// contains filtered or unexported fields
}
LedDisplay ...
func NewLedDisplay ¶
func NewLedDisplay(dioPin, rclkPin, sclkPin uint8) *LedDisplay
NewLedDisplay ...
type OLED ¶
type OLED struct {
// contains filtered or unexported fields
}
OLED ...
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is an interface used to set various options in BME280 object.
func HumOverSmpl ¶
HumOverSmpl sets default oversampling for humidity.
func PressOverSmpl ¶
PressOverSmpl sets default oversampling for pressure.
func TempOverSmpl ¶
TempOverSmpl sets default oversampling for temperature.
type PMS7003 ¶
type PMS7003 struct {
// contains filtered or unexported fields
}
PMS7003 ...
type SW420 ¶
type SW420 struct {
// contains filtered or unexported fields
}
SW420 ...
func (*SW420) KeepShaking ¶
KeepShaking returns true if the sensor detects the object keeps shaking in 100 millisecond, or returns false
type ShockSensor ¶
type ShockSensor struct {
// contains filtered or unexported fields
}
Collision ...
func NewShockSensor ¶
func NewShockSensor(pin uint8) *ShockSensor
type US100 ¶
type US100 struct {
// contains filtered or unexported fields
}
US100 ...
func (*US100) DistByUart ¶
DistByUart is to measure the distance in cm
type US100Config ¶
US100Config ...
type VoiceDetector ¶
type VoiceDetector struct {
// contains filtered or unexported fields
}
VoiceDetector ...
Source Files ¶
- BME280.go
- KY-008.go
- KY-026.go
- KY-034.go
- ads1015.go
- button.go
- buzzer.go
- camera.go
- collision.go
- common.go
- dht11.go
- ds18b20.go
- encoder.go
- gps.go
- gps_mock.go
- gy25.go
- hcsr04.go
- infrared.go
- joystick.go
- l298n.go
- lc12s.go
- led.go
- leddisplay.go
- mpu6050.go
- oled.go
- pcf8591.go
- pms7003.go
- relay.go
- rgbled.go
- rx480e4.go
- sg90.go
- shock.go
- stepmotor.go
- sw420.go
- tap.go
- us100.go
- voice.go
- ze08ch2o.go