Coder Social home page Coder Social logo

sorf / tinygo-drivers Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tinygo-org/drivers

0.0 0.0 0.0 1.87 MB

TinyGo drivers for sensors, displays, 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

Shell 0.70% C 0.10% Go 99.11% Makefile 0.05% Dockerfile 0.05%

tinygo-drivers's Introduction

TinyGo Drivers

PkgGoDev Build

This package provides a collection of 101 different hardware drivers for devices such as sensors and displays that can be used together with TinyGo.

For the complete list, please see: https://tinygo.org/docs/reference/devices/

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)
    }
}

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.

tinygo-drivers's People

Contributors

deadprogram avatar aykevl avatar sago35 avatar conejoninja avatar ofauchon avatar ysoldak avatar bgould avatar alankrantas avatar soypat avatar kenbell avatar breml avatar neildavis avatar quentinmit avatar k-brk avatar rogpeppe avatar yannishuber avatar pleomaxx3002 avatar jmacwhyte avatar ivoszz avatar thomasrichner-oviva avatar oflebbe avatar ncw avatar nerzal avatar baw-michael avatar jmstriegel avatar dwmunster avatar bxparks avatar torntrousers avatar droid42 avatar ikuiki 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.