dev

package
v0.0.0-...-791007e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2020 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

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:

  1. sudo vim /boot/config.txt
  2. add following line to the end of config.txt -------------------------- dtoverlay=dht11,gpiopin=4 --------------------------
  3. 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:

  1. $ sudo vim /boot/config.txt
  2. add following line at the end of the file ~~~~~~~~~~~~~~~~~~~~~~~~~~~ dtoverlay=w1-gpio,gpiopin=4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3. $ sudo reboot now
  4. 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:

  1. $ sudo raspi-config -> [P5 interface] -> P6 Serial: disable -> [no] -> [yes]
  2. $ sudo vim /boot/config.txt add following two lines: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ enable_uart=1 dtoverlay=pi3-miniuart-bt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3. $ sudo reboot now
  4. $ 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 ...

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 ...

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:

  1. $ sudo vim /boot/config.txt add following new line: ~~~~~~~~~~~~~~~~~ enable_uart=1 ~~~~~~~~~~~~~~~~~
  2. $ sudo vim /boot/cmdline.txt remove following contexts: ~~~~~~~~~~~~~~~~~~~~~~~~~~ console=serial0,115200 ~~~~~~~~~~~~~~~~~~~~~~~~~~
  3. $ sudo reboot now
  4. $ 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:

  1. $ sudo apt-get install -y python-smbus
  2. $ sudo apt-get install -y i2c-tools
  3. $ sudo raspi-config
  4. -> [5 interface options] -> [p5 i2c] ->[yes] -> [ok]
  5. $ sudo reboot now
  6. 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:

  1. $ sudo apt-get install -y python-smbus
  2. $ sudo apt-get install -y i2c-tools
  3. $ sudo raspi-config
  4. -> [5 interface options] -> [p5 i2c] ->[yes] -> [ok]
  5. $ sudo reboot now
  6. 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:

  1. $ sudo apt-get install -y python-smbus
  2. $ sudo apt-get install -y i2c-tools
  3. $ sudo raspi-config
  4. -> [5 interface options] -> [p5 i2c] ->[yes] -> [ok]
  5. $ sudo reboot now
  6. 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:

  1. $ sudo vim /boot/config.txt add following new line: ~~~~~~~~~~~~~~~~~ enable_uart=1 ~~~~~~~~~~~~~~~~~
  2. $ sudo vim /boot/cmdline.txt remove following contexts: ~~~~~~~~~~~~~~~~~~~~~~~~~~ console=serial0,115200 ~~~~~~~~~~~~~~~~~~~~~~~~~~
  3. $ sudo reboot now
  4. $ 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:

  • 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:

  1. $ sudo vim /boot/config.txt add following new line: ~~~~~~~~~~~~~~~~~ enable_uart=1 ~~~~~~~~~~~~~~~~~
  2. $ sudo vim /boot/cmdline.txt remove following contexts: ~~~~~~~~~~~~~~~~~~~~~~~~~~ console=serial0,115200 ~~~~~~~~~~~~~~~~~~~~~~~~~~
  3. $ sudo reboot now
  4. $ 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:

  1. $ sudo vim /boot/config.txt add following new line: ~~~~~~~~~~~~~~~~~ enable_uart=1 ~~~~~~~~~~~~~~~~~
  2. $ sudo vim /boot/cmdline.txt remove following contexts: ~~~~~~~~~~~~~~~~~~~~~~~~~~ console=serial0,115200 ~~~~~~~~~~~~~~~~~~~~~~~~~~
  3. $ sudo reboot now
  4. $ 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Button

type Button struct {
	// contains filtered or unexported fields
}

Button ...

func NewButton

func NewButton(pin uint8) *Button

NewButton ...

func (*Button) Pressed

func (b *Button) Pressed() bool

Pressed ...

type Buzzer

type Buzzer struct {
	// contains filtered or unexported fields
}

Buzzer ...

func NewBuzzer

func NewBuzzer(pin int8) *Buzzer

NewBuzzer ...

func (*Buzzer) Beep

func (b *Buzzer) Beep(n int, interval int)

Beep beeps [n] times with an interval in [interval] millisecond

func (*Buzzer) Off

func (b *Buzzer) Off()

Off ...

func (*Buzzer) On

func (b *Buzzer) On()

On ...

type Camera

type Camera struct {
}

Camera ...

func NewCamera

func NewCamera() *Camera

NewCamera ...

func (*Camera) TakePhoto

func (c *Camera) TakePhoto() (string, error)

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 Car

type Car struct {
	// contains filtered or unexported fields
}

Car ...

func NewCar

func NewCar(opts ...Option) *Car

NewCar ...

func (*Car) Do

func (c *Car) Do(op CarOp)

Do ...

func (*Car) GetState

func (c *Car) GetState() (selfDriving, selfTracking, speechDriving bool)

GetState ...

func (*Car) Start

func (c *Car) Start() error

Start ...

func (*Car) Stop

func (c *Car) Stop() error

Stop ...

type CarOp

type CarOp string

CarOp ...

type CollisionSwitch

type CollisionSwitch struct {
	// contains filtered or unexported fields
}

CollisionSwitch ...

func NewCollisionSwitch

func NewCollisionSwitch(pin uint8) *CollisionSwitch

NewCollisionSwitch ...

func (*CollisionSwitch) Collided

func (c *CollisionSwitch) Collided() bool

Collided ...

type DHT11

type DHT11 struct {
	// contains filtered or unexported fields
}

DHT11 ...

func NewDHT11

func NewDHT11() *DHT11

NewDHT11 ...

func (*DHT11) TempHumidity

func (d *DHT11) TempHumidity() (float64, float64, error)

TempHumidity ...

type DS18B20

type DS18B20 struct {
}

DS18B20 ...

func NewDS18B20

func NewDS18B20() *DS18B20

NewDS18B20 ...

func (*DS18B20) GetTemperature

func (d *DS18B20) GetTemperature() (float32, error)

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 Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder ...

func NewEncoder

func NewEncoder(pin uint8) *Encoder

NewEncoder ...

func (*Encoder) Count1

func (e *Encoder) Count1() int

Count1 ...

func (*Encoder) Detected

func (e *Encoder) Detected() bool

Detected ...

func (*Encoder) Start

func (e *Encoder) Start()

Start ...

func (*Encoder) Stop

func (e *Encoder) Stop()

Stop ...

type GPS

type GPS struct {
	// contains filtered or unexported fields
}

GPS ...

func NewGPS

func NewGPS() *GPS

NewGPS ...

func (*GPS) Close

func (g *GPS) Close()

Close ...

func (*GPS) Loc

func (g *GPS) Loc() (*base.Point, error)

Loc ...

func (*GPS) MockLocFromCSV

func (g *GPS) MockLocFromCSV() (*base.Point, error)

MockLocFromCSV ...

func (*GPS) MockLocFromGPX

func (g *GPS) MockLocFromGPX() (*base.Point, error)

MockLocFromGPX ...

type GPSLogger

type GPSLogger struct {
	// contains filtered or unexported fields
}

GPSLogger ...

func NewGPSLogger

func NewGPSLogger() *GPSLogger

NewGPSLogger ...

func (*GPSLogger) AddPoint

func (l *GPSLogger) AddPoint(pt *base.Point)

AddPoint ...

func (*GPSLogger) Close

func (l *GPSLogger) Close()

Close ...

type HCSR04

type HCSR04 struct {
	// contains filtered or unexported fields
}

HCSR04 ...

func NewHCSR04

func NewHCSR04(trig int8, echo int8) *HCSR04

NewHCSR04 ...

func (*HCSR04) Dist

func (h *HCSR04) Dist() float64

Dist is to measure the distance in cm

type Infrared

type Infrared struct {
	// contains filtered or unexported fields
}

Infrared ...

func NewInfrared

func NewInfrared(pin uint8) *Infrared

NewInfrared ...

func (*Infrared) Detected

func (i *Infrared) Detected() bool

Detected ...

type Joystick

type Joystick struct {
	// contains filtered or unexported fields
}

Joystick ...

func NewJoystick

func NewJoystick(sw uint8) (*Joystick, error)

NewJoystick ...

func (*Joystick) X

func (j *Joystick) X() (x int)

X ... -123 =< x <= 132 x > 0: left x = 0: home x < 0: right

func (*Joystick) Y

func (j *Joystick) Y() (y int)

Y ... -124 =< y <= 131 y > 0: up y = 0: home y < 0: down

func (*Joystick) Z

func (j *Joystick) Z() (z int)

Z ... z = 1: pressed z = 0: home

type L298N

type L298N struct {
	// contains filtered or unexported fields
}

L298N ...

func NewL298N

func NewL298N(in1, in2, in3, in4, ena, enb uint8) *L298N

NewL298N ...

func (*L298N) Backward

func (l *L298N) Backward()

Backward ...

func (*L298N) Forward

func (l *L298N) Forward()

Forward ...

func (*L298N) Left

func (l *L298N) Left()

Left ...

func (*L298N) Right

func (l *L298N) Right()

Right ...

func (*L298N) Speed

func (l *L298N) Speed(s uint32)

Speed ...

func (*L298N) Stop

func (l *L298N) Stop()

Stop ...

type LC12S

type LC12S struct {
	// contains filtered or unexported fields
}

LC12S ...

func NewLC12S

func NewLC12S(csPin uint8) *LC12S

NewLC12S ...

func (*LC12S) Close

func (l *LC12S) Close()

Close ...

func (*LC12S) Read

func (l *LC12S) Read() ([]byte, error)

Read ...

func (*LC12S) Sleep

func (l *LC12S) Sleep()

Sleep ...

func (*LC12S) Wakeup

func (l *LC12S) Wakeup()

Wakeup ...

func (*LC12S) Write

func (l *LC12S) Write(data []byte) error

Write ...

type Led

type Led struct {
	// contains filtered or unexported fields
}

Led ...

func NewLed

func NewLed(pin uint8) *Led

NewLed ...

func (l *Led) Blink(n int, interval int)

Blink is let led blink n time, interval Millisecond each time

func (*Led) Fade

func (l *Led) Fade(n uint8)

Fade ...

func (*Led) Off

func (l *Led) Off()

Off ...

func (*Led) On

func (l *Led) On()

On ...

type LedDisplay

type LedDisplay struct {
	// contains filtered or unexported fields
}

LedDisplay ...

func NewLedDisplay

func NewLedDisplay(dioPin, rclkPin, sclkPin uint8) *LedDisplay

NewLedDisplay ...

func (*LedDisplay) Close

func (d *LedDisplay) Close()

Close ...

func (*LedDisplay) Display

func (d *LedDisplay) Display(text string)

Display ...

func (*LedDisplay) Open

func (d *LedDisplay) Open()

Open ...

type MPU6050

type MPU6050 struct {
	// contains filtered or unexported fields
}

MPU6050 ...

func NewMPU6050

func NewMPU6050() (*MPU6050, error)

NewMPU6050 ...

func (*MPU6050) Close

func (m *MPU6050) Close()

Close ...

func (*MPU6050) GetAcc

func (m *MPU6050) GetAcc() (x int32, y int32, z int32)

GetAcc ...

func (*MPU6050) GetRot

func (m *MPU6050) GetRot() (x int32, y int32, z int32)

GetRot ...

type OLED

type OLED struct {
	// contains filtered or unexported fields
}

OLED ...

func NewOLED

func NewOLED(width, heigth int) (*OLED, error)

NewOLED ...

func (*OLED) Clear

func (o *OLED) Clear() error

Clear ...

func (*OLED) Close

func (o *OLED) Close()

Close ...

func (*OLED) Display

func (o *OLED) Display(text string, fontSize float64, x, y int) error

Display ...

func (*OLED) Off

func (o *OLED) Off()

Off ...

type Option

type Option func(c *Car)

Option ...

func WithCSwitchs

func WithCSwitchs(cswitchs []*CollisionSwitch) Option

WithCSwitchs ...

func WithCamera

func WithCamera(cam *Camera) Option

WithCamera ...

func WithEncoder

func WithEncoder(e *Encoder) Option

WithEncoder ...

func WithEngine

func WithEngine(engine *L298N) Option

WithEngine ...

func WithHorn

func WithHorn(horn *Buzzer) Option

WithHorn ...

func WithLed

func WithLed(led *Led) Option

WithLed ...

func WithLight

func WithLight(light *Led) Option

WithLight ...

func WithServo

func WithServo(servo *SG90) Option

WithServo ...

func WithUlt

func WithUlt(ult *US100) Option

WithUlt ...

type PCF8591

type PCF8591 struct {
	// contains filtered or unexported fields
}

PCF8591 ...

func NewPCF8591

func NewPCF8591() (*PCF8591, error)

NewPCF8591 ...

func (*PCF8591) Close

func (m *PCF8591) Close()

Close ...

func (*PCF8591) ReadAIN0

func (m *PCF8591) ReadAIN0() []byte

ReadAIN0 ...

func (*PCF8591) ReadAIN1

func (m *PCF8591) ReadAIN1() []byte

ReadAIN1 ...

func (*PCF8591) ReadAIN2

func (m *PCF8591) ReadAIN2() []byte

ReadAIN2 ...

func (*PCF8591) ReadAIN3

func (m *PCF8591) ReadAIN3() []byte

ReadAIN3 ...

type PMS7003

type PMS7003 struct {
	// contains filtered or unexported fields
}

PMS7003 ...

func NewPMS7003

func NewPMS7003() *PMS7003

NewPMS7003 ...

func (*PMS7003) Close

func (p *PMS7003) Close()

Close ...

func (*PMS7003) Get

func (p *PMS7003) Get() (uint16, uint16, error)

Get returns pm2.5 and pm10 in ug/m3

func (*PMS7003) Mock

func (p *PMS7003) Mock() (uint16, uint16, error)

Mock ...

type RX480E4

type RX480E4 struct {
	// contains filtered or unexported fields
}

RX480E4 ...

func NewRX480E4

func NewRX480E4(d0, d1, d2, d3 uint8) *RX480E4

NewRX480E4 ...

func (*RX480E4) PressA

func (r *RX480E4) PressA() bool

PressA ...

func (*RX480E4) PressB

func (r *RX480E4) PressB() bool

PressB ...

func (*RX480E4) PressC

func (r *RX480E4) PressC() bool

PressC ...

func (*RX480E4) PressD

func (r *RX480E4) PressD() bool

PressD ...

type Relay

type Relay struct {
	// contains filtered or unexported fields
}

Relay ...

func NewRelay

func NewRelay(pin uint8) *Relay

NewRelay ...

func (*Relay) Off

func (r *Relay) Off()

Off ...

func (*Relay) On

func (r *Relay) On()

On ...

type SG90

type SG90 struct {
	// contains filtered or unexported fields
}

SG90 ...

func NewSG90

func NewSG90(pin uint8) *SG90

NewSG90 ...

func (*SG90) Roll

func (s *SG90) Roll(angle int)

Roll ... angle: [-90, 90] angle < 0: left angel = 0: ahead angle > 0: right e.g.

-30  0   30
  \  |  /
   \ | /
    \|/
     *
    eye

type SW420

type SW420 struct {
	// contains filtered or unexported fields
}

SW420 ...

func NewSW420

func NewSW420(pin uint8) *SW420

NewSW420 ...

func (*SW420) KeepShaking

func (s *SW420) KeepShaking() bool

KeepShaking returns true if the sensor detects the object keeps shaking in 100 millisecond, or returns false

func (*SW420) Shaked

func (s *SW420) Shaked() bool

Shaked returns true if the sensor detects a shake, or return false

type StepMotor

type StepMotor struct {
	// contains filtered or unexported fields
}

StepMotor ...

func NewStepMotor

func NewStepMotor(in1, in2, in3, in4 uint8) *StepMotor

NewStepMotor ...

func (*StepMotor) Roll

func (s *StepMotor) Roll(angle float32)

Roll ...

func (*StepMotor) Stop

func (s *StepMotor) Stop()

Stop ...

type US100

type US100 struct {
	// contains filtered or unexported fields
}

US100 ...

func NewUS100

func NewUS100() *US100

NewUS100 ...

func (*US100) Close

func (u *US100) Close()

Close ...

func (*US100) Dist

func (u *US100) Dist() float64

Dist is to measure the distance in cm

type VoiceDetector

type VoiceDetector struct {
	// contains filtered or unexported fields
}

VoiceDetector ...

func NewVoiceDetector

func NewVoiceDetector(pin uint8) *VoiceDetector

NewVoiceDetector ...

func (*VoiceDetector) Detected

func (v *VoiceDetector) Detected() bool

Detected ...

type ZE08CH2O

type ZE08CH2O struct {
	// contains filtered or unexported fields
}

ZE08CH2O ...

func NewZE08CH2O

func NewZE08CH2O() *ZE08CH2O

NewZE08CH2O ...

func (*ZE08CH2O) Close

func (p *ZE08CH2O) Close()

Close ...

func (*ZE08CH2O) Get

func (p *ZE08CH2O) Get() (float64, error)

Get returns ch2o in mg/m3

func (*ZE08CH2O) Mock

func (p *ZE08CH2O) Mock() (float64, error)

Mock ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL