Skip to content
TinyGo drivers for I2C, SPI, and other similar devices.
Branch: master
Clone or download
deadprogram and aykevl examples: add example code for BlinkM
Signed-off-by: Ron Evans <ron@hybridgroup.com>
Latest commit b8e278e Mar 11, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
apa102
bh1750
blinkm
bmp180 Initial support for BMP180 digital pressure sensor (#11) Feb 6, 2019
easystepper easystepper: very simple 4-wire stepper driver Feb 23, 2019
espat espat: add support for esp8266/esp32 Wifi adaptor AT command set with… Feb 24, 2019
examples examples: add example code for BlinkM Mar 14, 2019
mag3110
mma8653 mma8653: return acceleration in a standard unit: micro-G. Mar 11, 2019
mpu6050
vl53v1x
ws2812
LICENSE license: add BSD-3 license for the TinyGo Authors Feb 7, 2019
README.md
drivers.go rename: make sure package name is consistent in all places after move… Feb 7, 2019

README.md

TinyGo Drivers

GoDoc

This package provides a collection of hardware drivers for devices that can be used together with TinyGo.

Installing

go get github.com/tinygo-org/drivers

How to use

Here is an example in TinyGo that uses the BMP180 digital barometer:

package main

import (
    "time"

    "machine"

    "github.com/tinygo-org/drivers/bmp180"
)

func main() {
    machine.I2C0.Configure(machine.I2CConfig{})
    sensor := bmp180.New(machine.I2C0)
    sensor.Configure()

    connected := sensor.Connected()
    if !connected {
        println("BMP180 not detected")
        return
    }
    println("BMP180 detected")

    for {
        temp, _ := sensor.Temperature()
        println("Temperature:", float32(temp)/1000, "ºC")

        pressure, _ := sensor.Pressure()
        println("Pressure", float32(pressure)/100000, "hPa")

        time.Sleep(2 * time.Second)
    }
}

Currently supported devices

Device Name Interface Type
APA102 RGB LED SPI
BH1750 ambient light sensor I2C
BlinkM RGB LED I2C
BMP180 barometer I2C
"Easystepper" stepper motor controller GPIO
ESP8266/ESP32 AT Command set for WiFi/TCP/UDP UART
MAG3110 magnetometer I2C
MMA8653 accelerometer I2C
MPU6050 accelerometer/gyroscope I2C
VL53L1X time-of-flight distance sensor I2C
WS2812 RGB LED GPIO

Contributing

This collection of drivers is part of the TinyGo project. Patches are welcome but new drivers should follow the patterns established by similar existing drivers.

License

This project is licensed under the BSD 3-clause license, just like the Go project itself.

You can’t perform that action at this time.