Skip to content

TinyGo drivers for sensors and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.

License

Notifications You must be signed in to change notification settings

HarringayMakerSpace/drivers

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TinyGo Drivers

GoDoc CircleCI

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

Installing

go get tinygo.org/x/drivers

How to use

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

package main

import (
    "time"

    "machine"

    "tinygo.org/x/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.ReadTemperature()
        println("Temperature:", float32(temp)/1000, "ºC")

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

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

Currently supported devices

The following 35 devices are supported.

Device Name Interface Type
ADXL345 accelerometer I2C
APA102 RGB LED SPI
AT24CX 2-wire serial EEPROM I2C
BH1750 ambient light sensor I2C
BlinkM RGB LED I2C
BME280 humidity/pressure sensor I2C
BMP180 barometer I2C
Buzzer GPIO
DS1307 real time clock I2C
DS3231 real time clock I2C
"Easystepper" stepper motor controller GPIO
ESP32 as WiFi Coprocessor with Arduino nina-fw SPI
ESP8266/ESP32 AT Command set for WiFi/TCP/UDP UART
GPS module I2C/UART
HUB75 RGB led matrix SPI
LIS3DH accelerometer I2C
LSM6DS3 accelerometer I2C
MAG3110 magnetometer I2C
MCP3008 analog to digital converter (ADC) SPI
BBC micro:bit LED matrix GPIO
Microphone - PDM I2S/PDM
MMA8653 accelerometer I2C
MPU6050 accelerometer/gyroscope I2C
PCD8544 display SPI
Shift register GPIO
SHT3x Digital Humidity Sensor I2C
SSD1306 OLED display I2C / SPI
SSD1331 TFT color display SPI
ST7735 TFT color display SPI
ST7789 TFT color display SPI
Thermistor ADC
VEML6070 UV light sensor I2C
VL53L1X time-of-flight distance sensor I2C
Waveshare 2.13" e-paper display SPI
Waveshare 2.13" (B & C) e-paper display SPI
WS2812 RGB LED GPIO

Contributing

Your contributions are welcome!

Please take a look at our CONTRIBUTING.md document for details.

License

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

About

TinyGo drivers for sensors and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 98.1%
  • Makefile 1.9%