Documentation ¶
Overview ¶
A4988 is a driver for A4988 driver board used to drive stepper motor such as NAME.
Connect to Pi:
vmot: 5v pin of rpi, or 5~35v power supply for motor
gnd : any gnd pin of rpi, or the gnd of power supply
vcc : any 5v pin
gnd : any gnd pin
step: any data pin
dir : any data pin
ms1 : any data pin
ms2 : any data pin
ms3 : any data pin
NOTE:
This driver didn't implement reset, sleep and enable/disable.
You should typing [sleep] to [reset] pin to get the module always doesn't sleep.
And get [enable] tying nothing to get module always be enabled.
ADS1015 is a 12-bit analog-digital converter. It is a implement of ADC interface. More details about ADS1015, please ref to: https://www.adafruit.com/product/1083 https://cdn-learn.adafruit.com/downloads/pdf/adafruit-4-channel-adc-breakouts.pdf
Config Raspberry 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: -- -- -- -- -- -- -- -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connect to Raspberry Pi: - VCC: any 3.3v pin - GND: any GND pin - SDA: GPIO-2 (SDA) - SCL: GPIO-3 (SCL)
Afuiot-B1 is a sensor used to measure the temperature of human or object through infrared ray.
Config Raspberry 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 to Raspberry Pi:
- VCC: any 3.3v or 5v pin
- GND: any gnd pin
- RXT: must connect to GPIO-14/TXD
- TXD: must connect to GPIO-15/RXD
ButtonImp is a button module used to detect whether a button is pressed.
Connect to Raspberry Pi for a 3-pin buttom mobule:
- vcc: any 3.3v pin
- gnd: any gnd pin
- out: any data pin
Connect to Raspberry Pi for a 2-pin buttom mobule:
- port-1: any 3.3v pin
- port-2: any data pin
BYJ2848 is a driver for stepper motor using ULN2003 driver board with 4-phase and 5-wire.
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
CollisionSwitch is used to detect a collision with an object or to detect the limit of travel.
Connect to Raspberry Pi:
- vcc: any 3.3v or v5 pin
- gnd: any gnd pin
- out: any data pin
DHT11 is a sensor used to meature temperature and humidity.
Config Raspberry Pi:
- sudo vim /boot/config.txt
- add following line to the end of config.txt -------------------------- dtoverlay=dht11,gpiopin=4 --------------------------
Connect to Raspberry Pi:
VCC: any 3.3v pin GND: any gnd pin SIGNAL: must connect to GPIO-4
TM1637Display is a dirvier for digital led display module drived by TM1637 chip. Please note that I only test it on a 4-bit led digital module. And Only following chars were supported. 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 Raspberry Pi:
- VCC: any v3.3 pin
- GND: any gnd pin
- DIO: any data pin
- SCLK: any data pin
- RCLK: any data pin
SSD1306Display is a driver for the oled display module drived by SSD1306 chip. Config Raspberry 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: -- -- -- -- -- -- -- -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connect to Raspberry Pi:
- VCC: any 3.3v pin
- GND: any GND pin
- SDA: GPIO-2 (SDA)
- SCL: GPIO-3 (SCL)
DS18B20 is sensor used to meature temperature.
Config Raspberry 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 Raspberry Pi:
- vcc: any 3.3v pin
- gnd: any gnd pin
- dat: must connect to GPIO-4
Encoder is a sensor used to count number.
Connect to Raspberry Pi:
- vcc: any 3.3v or v5 pin
- gnd: any gnd pin
- out: any data pin
Fan is a fan module using 3.3v power source.
Connect to Raspberry Pi:
- vcc(red line) : any data pin(~3.3v)
- gnd(black line): any gnd pin
Neo6mGPS is a GPS module used to get locations(lat/lon).
Config Raspberry 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 to Raspberry Pi:
- VCC: any 3.3v or 5v pin
- GND: any gnd pin
- RXT: must connect to GPIO-14/TXD
- TXD: must connect to GPIO-15/RXD
Neo6mGPS is a GPS module used to get locations(lat/lon).
Config Raspberry 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 to Raspberry Pi:
- VCC: any 3.3v or 5v pin
- GND: any gnd pin
- RXT: must connect to GPIO-14/TXD
- TXD: must connect to GPIO-15/RXD
GY25 is an accelerometer used to detect yaw, pitch and roll angles.
Config Raspberry 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 Raspberry Pi:
- VCC: any 3.3v or 5v pin
- GND: any gnd pin
- RXT: must connect to GPIO-14/TXD
- TXD: must connect to GPIO-15/RXD
HC-SR04 is an ultrasonic distance meter used to measure the distance to objects. min distance: 2cm max distance: 600cm
Spec:
- power supply: +5V DC
- range: 2 - 450cm
- resolution: 0.3cm ___________________________ | | | HC-SR04 | | | |___________________________| | | | | vcc trig echo gnd
Connect to Raspberry Pi:
- vcc: any 5v pin
- gnd: any gnd pin
- trig: any data pin
- echo: any data pin
HDC1080 is a sensor used to measure temperature and humidity. It is a implement of TempHumidity interface.
Config Raspberry 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: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connect to Raspberry Pi: - VCC: any 3.3v pin - GND: any GND pin - SDA: GPIO-2 (SDA) - SCL: GPIO-3 (SCL)
IRCoder is an infrared(IR) encoder and decoder ¶
Config Raspberry 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 Raspberry Pi:
- VCC: any 5v pin
- GND: any gnd pin
- RXT: must connect to GPIO-14/TXD
- TXD: must connect to GPIO-15/RXD
IRDetector is a sensor used to detected infrared ray.
Connect to Pi:
- vcc: any 3.3v pin
- gnd: any gnd pin
- out: any data pin
JoystickImp is 2-axis joystick module.
Connect to Pi:
- +V5: any 5v
- GND: any gnd pin
- SM : any data pin
- Rx: ADS1015->A0
- Ry: ADS1015->A1
L298N is a motor driver used to control the direction and speed of DC motors.
Spec:
_________________________________________ | | | | OUT1 -| L298N |- OUT3 OUT2 -| |- OUT4 | | |_________________________________________| | | | | | | | | | 12v GND 5V ENA IN1 IN2 IN3 IN4 ENB
Pins:
OUT1: dc motor A+
OUT2: dc motor A-
OUT3: dc motor B+
OUT4: dc motor B-
12v: +battery
GND: -battery (and any gnd pin of raspberry pi if motors and raspberry pi use different battery sources)
IN1: any data pin
IN2: any data pin
IN3: any data pin
IN4: any data pin
EN1: must be one of GPIO 12, 13, 18 or 19 (pwn pins)
EN2: must be one of GPIO 12, 13, 18 or 19 (pwn pins)
LC12S is wireless transceiver used to send and receive data via electromagnetic wave. More details please ref to: https://world.taobao.com/item/594554513623.htm
Config Raspberry 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 Raspberry Pi:
- VCC: any 3.3v
- GND: any gnd pin
- CS: any data pin. high-level: sleep, low-level: work
- RX: must connect to GPIO-14/TXD
- TX: must connect to GPIO-15/RXD
LD2410 is a sensor used to detected human existing or not.
Connect to Pi:
- vcc: any 5v pin
- gnd: any gnd pin
- out: any data pin
LedImp is led light diodes module.
Connect to Raspberry Pi:
- vcc(the longer pin) : any data pin(~3.3v)
- gnd(the shorter pin): any gnd pin
mpu6050 is a 3-axis gyroscope and a 3-axis accelerometer.
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: -- -- -- -- -- -- -- -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connect to Raspberry Pi:
- VCC: any 3.3v pin
- GND: any GND pin
- SDA: GPIO-2 (SDA)
- SCL: GPIO-3 (SCL)
MQ-7 is a sensor used to detected co gas.
Connect to Pi:
- vcc: any 3.3v pin
- gnd: any gnd pin
- do: any data pin
- ao: (don't support currently)
PCF8591 is the driver of PCF8591 module.
Jumper: - remove jumpers on P4 & P5, keep the jumper on P6
Config Raspberry 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: -- -- -- -- -- -- -- -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connect to Raspberry Pi:
- VCC: any 3.3v pin
- GND: any GND pin
- SDA: GPIO-2 (SDA)
- SCL: GPIO-3 (SCL)
PMS7003 is an air quality sensor which can be used to measure PM2.5 and PM10.
Config Raspberry 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 Raspberry Pi:
- VCC: any 5v pin
- GND: any gnd pin
- RX: must connect to GPIO-14/TXD
- TX: must connect to GPIO-15/RXD
PumpImp is a driver for ~3.3v pump motor module.
Connect to Raspberry Pi:
- vcc(red line) : any data pin(~3.3v)
- gnd(black line): any gnd pin
relay is an electrically operated switch module.
Connect to Raspberry Pi:
- vcc: any 5v pin
- gnd: any gnd pin
- in: any data pin
- on: the outside device
- com: the bettery
RFP-602 is a sensor used to detected pressure.
Connect to Pi:
- vcc: any 3.3v pin
- gnd: any gnd pin
- do: any data pin
- ao: (don't support currently)
RX480E4 is a transmitter receiver decoding module with 4 channels.
Connect to Raspberry 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
SG90 is servo motor which can roll angels from 0~180 degree.
Connect to Raspberry Pi:
- the red line: any 5v pin
- the brown line: any gnd pin
- the yellow line: must be one of gpio 12, 13, 18 or 19 (pwn pins)
SW-420 is an sensor used to detect shaking.
Connect to Pi:
- vcc: any 3.3v pin
- gnd: any gnd pin
- do : any data pin
US-100 is an ultrasonic distance meter used to measure the distance to objects. US-100 supports both of interfaces: GPIO and UART. min distance: 2cm max distance: 450cm
Config Raspberry 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 Raspberry Pi: GPIO Interface:
VCC: any 3.3v or 5v pin
GND: any gnd pin
Trig: any gnd pin
Echo: any gnd pin
UART Interface:
VCC: any 3.3v or 5v pin
GND: any gnd pin
...............................................
!!! NOTE: TX->TXD, RX-RXD, NOT TX->RXD, RX-TXD
...............................................
TX: must connect to GPIO-14 (TXD)
RX: must connect to GPIO-15 (RXD)
ZE08CH2O is a sensor used to detect CH2O.
Config Raspberry 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 Raspberry Pi:
- VCC: any 5v pin
- GND: any gnd pin
- TXD: must connect to GPIO-15 (RXD)
ZP16 is a gas detect module.
Config Raspberry 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 to Raspberry Pi:
- VCC: any 3.3v or 5v pin
- GND: any gnd pin
- RXT: must connect to GPIO-14/TXD
- TXD: must connect to GPIO-15/RXD
Index ¶
- Constants
- Variables
- type A4988
- type ADC
- type ADS1015
- type Accelerometer
- type AfuiotB1
- type BYJ2848
- type Button
- type ButtonImp
- type Buzzer
- type BuzzerImp
- type CH2OMeter
- type Camera
- type CollisionSwitch
- type DCMotor
- type DHT11
- type DS18B20
- type Detector
- type Display
- type DistanceMeter
- type Encoder
- type EncoderImp
- type Fan
- type GPS
- type GPSSimulator
- type GY25
- type GY25Mode
- type HCSR04
- type HDC1080
- type HT1818GPS
- type HumidityDetector
- type Hygrometer
- type IRCoder
- type IRDetector
- type InterfaceType
- type Joystick
- type JoystickImp
- type L298N
- type LC12S
- type LD2410
- type LcdDisplay
- type Led
- type LedImp
- type LogicLevel
- type MPU6050
- type MQ7
- type MotionCamera
- type Motor
- type MotorDriver
- type Neo6mGPS
- type PCF8591
- type PMS7003
- type Pump
- type PumpImp
- type RFP602
- type RFReceiver
- type RX480E4
- type Relay
- type RelayImp
- type SG90
- type SSD1306Display
- type ST7789Display
- type SW420
- type ServoMotor
- type StepperMode
- type StepperMotor
- type TM1637Display
- type Thermohygrometer
- type Thermometer
- type US100
- type VoiceDetector
- type Wireless
- type ZE08CH2O
- type ZP16
Constants ¶
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 )
const ( // Recommended Minimum Specific Data from GPS GPRMC = "$GPRMC," // Recommended Minimum Specific Data from GPS & Beidou/China GNRMC = "$GNRMC," )
Variables ¶
var ( SetAfuiotB1Uart = []byte{0xAA, 0xA5, 0x04, 0x05, 0x01, 0x0A, 0x55} SetAfuiotB1I2C = []byte{0xAA, 0xA5, 0x04, 0x05, 0x02, 0x0A, 0x55} SetAfuiotB1ObjectTemp = []byte{0xAA, 0xA5, 0x04, 0x02, 0x01, 0x07, 0x55} SetAfuiotB1HumanTemp = []byte{0xAA, 0xA5, 0x04, 0x02, 0x02, 0x08, 0x55} )
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 ¶
This section is empty.
Types ¶
type A4988 ¶
type A4988 struct {
// contains filtered or unexported fields
}
A4988 ...
func (*A4988) Roll ¶
Roll gets the motor rolls angle degree. roll in clockwise direction if angle > 0, or roll in counter-clockwise direction if angle < 0, or motionless if angle = 0.
func (*A4988) SetMode ¶
func (a *A4988) SetMode(mode StepperMode) error
SetMode sets the stepping mode
type ADS1015 ¶
type ADS1015 struct {
// contains filtered or unexported fields
}
ADS1015 is a 12-bit analog-digital converter. It implements ADC interface
type Accelerometer ¶
Accelerometer ...
type AfuiotB1 ¶
type AfuiotB1 struct {
// contains filtered or unexported fields
}
AfuiotB1 implements Thermometer interface
type BYJ2848 ¶
type BYJ2848 struct {
// contains filtered or unexported fields
}
BYJ2848 implements StepperMotor interface
func (*BYJ2848) Roll ¶
Roll gets the motor rolls angle degree. roll in clockwise direction if angle > 0, or roll in counter-clockwise direction if angle < 0, or motionless if angle = 0.
func (*BYJ2848) SetMode ¶
func (byj *BYJ2848) SetMode(mode StepperMode) error
SetMode sets the stepping mode. Please NOTE only FullMode is supported currently, and FullMode is used by default.
type ButtonImp ¶
type ButtonImp struct {
// contains filtered or unexported fields
}
ButtonImp implements Button interface
type BuzzerImp ¶
type BuzzerImp struct {
// contains filtered or unexported fields
}
BuzzerImp implements Buzzer interface
type CollisionSwitch ¶
type CollisionSwitch struct {
// contains filtered or unexported fields
}
CollisionSwitch implements Detector interface
func NewCollisionSwitch ¶
func NewCollisionSwitch(pin uint8) *CollisionSwitch
NewCollisionSwitch ...
type DHT11 ¶
type DHT11 struct {
// contains filtered or unexported fields
}
DHT11 implements Thermohygrometer interface
func (*DHT11) TempHumidity ¶
TempHumidity ...
type DS18B20 ¶
type DS18B20 struct { }
DS18B20 implements Thermometer interface
func (*DS18B20) Temperature ¶
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 Display ¶
type Display interface { Image(img image.Image) error Text(text string, x, y int) error On() error Off() error Clear() error Close() error }
Display ...
type DistanceMeter ¶
DistanceMeter ...
type EncoderImp ¶
type EncoderImp struct {
// contains filtered or unexported fields
}
EncoderImp implements Encoder interface
type GPSSimulator ¶
type GPSSimulator struct {
// contains filtered or unexported fields
}
GPSSimulator implements GPS interface
func NewGPSSimulator ¶
func NewGPSSimulator(latlons [][]float64) (*GPSSimulator, error)
NewGPSSimulator ...
type GY25 ¶
type GY25 struct {
// contains filtered or unexported fields
}
GY25 implements Accelerometer interface
type HCSR04 ¶
type HCSR04 struct {
// contains filtered or unexported fields
}
HCSR04 implements DistanceMeter interface
type HDC1080 ¶
type HDC1080 struct {
// contains filtered or unexported fields
}
HDC1080 ...
func NewHDC1080 ¶
NewHDC1080 implement Thermohygrometer interface
func (*HDC1080) TempHumidity ¶
TempHumidity ...
type HT1818GPS ¶
type HT1818GPS struct {
// contains filtered or unexported fields
}
HT1818GPS implements GPS interface
type HumidityDetector ¶
type HumidityDetector struct {
// contains filtered or unexported fields
}
HumidityDetector implements Detector interface
func NewHumidityDetector ¶
func NewHumidityDetector(pin uint8) *HumidityDetector
NewHumidityDetector ...
type IRDetector ¶
type IRDetector struct {
// contains filtered or unexported fields
}
IRDetector implements Detector interface
type JoystickImp ¶
type JoystickImp struct {
// contains filtered or unexported fields
}
JoystickImp ...
type L298N ¶
type L298N struct { MotorA MotorDriver MotorB MotorDriver }
L298N implements MotorDriver interface
type LC12S ¶
type LC12S struct {
// contains filtered or unexported fields
}
LC12S implement Wireless interface
type LD2410 ¶
type LD2410 struct {
// contains filtered or unexported fields
}
LD2410 implements Detector interface
type LcdDisplay ¶
type LcdDisplay struct {
// contains filtered or unexported fields
}
LcdDisplay is a driver for LCD Dispaly.
func NewLcdDisplay ¶
func NewLcdDisplay(width, height int) (*LcdDisplay, error)
NewLcdDisplay creates a driver for LCD display. It is an implement of Display interface. Please NOTE that I only test it on a 1602A lcd display module.
func (*LcdDisplay) Clear ¶
func (lcd *LcdDisplay) Clear() error
func (*LcdDisplay) Close ¶
func (lcd *LcdDisplay) Close() error
func (*LcdDisplay) Image ¶
func (lcd *LcdDisplay) Image(img image.Image) error
Image displays an image on the screen. NOTE: it isn't be implemented yet.
func (*LcdDisplay) Off ¶
func (lcd *LcdDisplay) Off() error
func (*LcdDisplay) On ¶
func (lcd *LcdDisplay) On() error
type LedImp ¶
type LedImp struct {
// contains filtered or unexported fields
}
LedImp implements Led interface
type MQ7 ¶
type MQ7 struct {
// contains filtered or unexported fields
}
MQ7 implements Detector interface
type MotionCamera ¶
type MotionCamera struct { }
MotionCamera implements Camera interface
func (*MotionCamera) Photo ¶
func (c *MotionCamera) Photo() ([]byte, error)
Photo takes 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' you also need to make sure webcontrol_port=8088 for this function working. after changing, this will be look like: ----------------------------------------- target_dir /var/lib/motion snapshot_filename lastsnap.jpg webcontrol_port 8088 -----------------------------------------
type Motor ¶
type Motor interface { Forward() Backward() Stop() SetSpeed(percent uint32) }
Motor ...
type Neo6mGPS ¶
type Neo6mGPS struct {
// contains filtered or unexported fields
}
Neo6mGPS implements GPS interface
type PumpImp ¶
type PumpImp struct {
// contains filtered or unexported fields
}
PumpImp implements Pump interface
type RFP602 ¶
type RFP602 struct {
// contains filtered or unexported fields
}
RFP602 implements Detector interface
type RFReceiver ¶
RFReciver is the interface of radio-frequency receiver
type RX480E4 ¶
type RX480E4 struct {
// contains filtered or unexported fields
}
RX480E4 implements RFReceiver
type SG90 ¶
type SG90 struct {
// contains filtered or unexported fields
}
SG90 implements Motor interface
type SSD1306Display ¶
type SSD1306Display struct {
// contains filtered or unexported fields
}
SSD1306Display is a driver for the oled display module drived by SSD1306 chip. It is an implement of Display interface.
func NewSSD1306Display ¶
func NewSSD1306Display(width, heigth int) (*SSD1306Display, error)
NewSSD1306Display creates a driver for the oled display module drived by SSD1306 chip
type ST7789Display ¶
type ST7789Display struct {
// contains filtered or unexported fields
}
ST7789Display is a driver for the tft lcd display module drived by ST7789 chip. It is an implement of Display interface.
func NewST7789Display ¶
func NewST7789Display(res, dc, blk uint8, width, height int) (*ST7789Display, error)
NewST7789Display create a driver for the tft lcd display module drived by ST7789 chip. Note that you should disable SPI interface in raspi-config first!
type SW420 ¶
type SW420 struct {
// contains filtered or unexported fields
}
SW420 implements Detector interface
type ServoMotor ¶
type ServoMotor interface { // Roll gets the servo motor rolls angle dregee in clockwise direction if angle > 0, // or roll in counter-clockwise direction if angle < 0, // motionless if angle = 0. Roll(angle float64) }
ServoMotor ...
type StepperMode ¶
type StepperMode int
const ( FullMode StepperMode = iota HalfMode QuarterMode EighthMode SixteenthMode )
type StepperMotor ¶
type StepperMotor interface { // Step gets the stepper motor rolls n steps in clockwise direction if angle > 0, // or roll in counter-clockwise direction if n < 0, // or motionless if n = 0. Step(n int) // Roll gets the stepper motor rolls angle dregee in clockwise direction if angle > 0, // or roll in counter-clockwise direction if angle < 0, // motionless if angle = 0. Roll(angle float64) // SetMode sets sets the stepping mode. // For example: Full, Half, Quarter, Eighth, Sixteenth. // Please NOTE not all steppers support all modes. Some steppers only support one or two modes. SetMode(mode StepperMode) error }
Stepper ...
type TM1637Display ¶
type TM1637Display struct {
// contains filtered or unexported fields
}
TM1637Display is a dirvier for digital led display module drived by TM1637 chip. It is an implement of Display interface.
func NewTM1637Display ¶
func NewTM1637Display(dioPin, rclkPin, sclkPin uint8) *TM1637Display
NewTM1637Display creates a TM1637Display driver. Please NOTE that I only test it on a 4-bit digital led module.
type Thermohygrometer ¶
Thermohygrometer ...
type US100 ¶
type US100 struct {
// contains filtered or unexported fields
}
US100 ...
func NewUS100GPIO ¶
NewUS100GPIO creates US100 using GPOI interface
func NewUS100UART ¶
NewUS100UART creates US100 using UART interface
type VoiceDetector ¶
type VoiceDetector struct {
// contains filtered or unexported fields
}
VoiceDetector implements Detector interface
type Wireless ¶
type Wireless interface { Send(data []byte) error Receive() ([]byte, error) Sleep() Wakeup() Close() error }
Wireless ...
Source Files ¶
- a4988.go
- ads1015.go
- afuiot_b1.go
- button_imp.go
- buzzer_imp.go
- byj2848.go
- collision_switch.go
- common.go
- dcmotor.go
- dht11.go
- display_lcd.go
- display_led_tm1637.go
- display_oled_ssd1306.go
- display_tft_st7789.go
- ds18b20.go
- encoder_imp.go
- fan.go
- gps_ht1818.go
- gps_neo6m.go
- gps_simulator.go
- gy25.go
- hcsr04.go
- hdc1080.go
- humidity_detector.go
- iface.go
- ir_coder.go
- ir_detector.go
- joystick_imp.go
- l298n.go
- lc12s.go
- ld2410.go
- led_imp.go
- motion_camera.go
- mpu6050.go
- mq7.go
- pcf8591.go
- pms7003.go
- pump.go
- relay_imp.go
- rfp602.go
- rx480e4.go
- sg90.go
- sw420.go
- us100.go
- voice_detector.go
- ze08ch2o.go
- zp16.go