Coder Social home page Coder Social logo

directionless / drivers Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tinygo-org/drivers

0.0 3.0 0.0 107 KB

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

Home Page: https://tinygo.org

License: BSD 3-Clause "New" or "Revised" License

Go 100.00%

drivers's Introduction

TinyGo Drivers

GoDoc CircleCI

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

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

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

Currently supported devices

Device Name Interface Type
ADXL345 accelerometer I2C
APA102 RGB LED SPI
BH1750 ambient light sensor I2C
BlinkM RGB LED I2C
BMP180 barometer I2C
DS3231 real time clock I2C
"Easystepper" stepper motor controller GPIO
ESP8266/ESP32 AT Command set for WiFi/TCP/UDP UART
HUB75 RGB led matrix SPI
LIS3DH accelerometer I2C
MAG3110 magnetometer I2C
BBC micro:bit LED matrix GPIO
MMA8653 accelerometer I2C
MPU6050 accelerometer/gyroscope I2C
PCD8544 display SPI
SSD1306 OLED display I2C / SPI
Thermistor ADC
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.

drivers's People

Contributors

deadprogram avatar aykevl avatar conejoninja avatar k-brk avatar

Watchers

seph avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.