1
0
mirror of https://github.com/kidoman/embd synced 2024-12-22 12:50:19 +01:00

doc: cleanup

also, change the code in simpleblinker.go to match the docs
This commit is contained in:
Karan Misra 2014-04-13 14:02:15 +05:30
parent 7c51f968af
commit 94e2ca4ae3
2 changed files with 10 additions and 6 deletions

View File

@ -1,9 +1,13 @@
# embd [![Build Status](https://travis-ci.org/kidoman/embd.svg?branch=master)](https://travis-ci.org/kidoman/embd) [![GoDoc](http://godoc.org/github.com/kidoman/embd?status.png)](http://godoc.org/github.com/kidoman/embd) # embd [![Build Status](https://travis-ci.org/kidoman/embd.svg?branch=master)](https://travis-ci.org/kidoman/embd) [![GoDoc](http://godoc.org/github.com/kidoman/embd?status.png)](http://godoc.org/github.com/kidoman/embd)
A superheroic hardware abstraction layer for doing embedded programming on supported platforms like the Raspberry Pi and BeagleBone Black. **embd** is a hardware abstraction layer (HAL) for embedded systems.
It allows you to start your hardware hack on easily available hobby boards (like the Raspberry Pi, BeagleBone Black, etc.) by giving you staight forward access to the board's capabilities as well as a plethora of **sensors** (like accelerometers, gyroscopes, thermometers, etc.) and **controllers** (PWM generators, digital-to-analog convertors) for which we have written drivers. And when things get serious, you dont have to throw away the code. You carry forward the effort onto more custom designed boards where the HAL abstraction of EMBD will save you precious time.
Development supported and sponsored by [**ThoughtWorks**](http://www.thoughtworks.com/) Development supported and sponsored by [**ThoughtWorks**](http://www.thoughtworks.com/)
Also, you might be interested in: [Why Golang?](https://github.com/kidoman/embd/wiki/Why-Go)
## Getting Started ## Getting Started
After installing Go* and setting up your [GOPATH](http://golang.org/doc/code.html#GOPATH), create your first .go file. We'll call it ```simpleblinker.go```. After installing Go* and setting up your [GOPATH](http://golang.org/doc/code.html#GOPATH), create your first .go file. We'll call it ```simpleblinker.go```.
@ -15,12 +19,12 @@ import (
"time" "time"
"github.com/kidoman/embd" "github.com/kidoman/embd"
_ "github.com/kidoman/embd/host/rpi" _ "github.com/kidoman/embd/host/rpi" // This loads the RPi driver
) )
func main() { func main() {
for { for {
embd.LEDToggle(0) embd.LEDToggle("LED0")
time.Sleep(250 * time.Millisecond) time.Sleep(250 * time.Millisecond)
} }
} }
@ -44,7 +48,7 @@ Then run the program with ```sudo```*:
$ sudo ./simpleblinker $ sudo ./simpleblinker
You will now see the green LED (next to the always on power LED) blink every 1/4 sec. **You will now see the green LED (next to the always on power LED) blink every 1/4 sec.**
**<nowiki>*</nowiki> Notes** **<nowiki>*</nowiki> Notes**
@ -103,7 +107,7 @@ Use the **LED** driver to toggle LEDs on the BBB:
... ...
led.Toggle() led.Toggle()
Even shorter while prototyping: Even shorter when quickly trying things out:
import "github.com/kidoman/embd" import "github.com/kidoman/embd"
... ...

View File

@ -9,7 +9,7 @@ import (
"time" "time"
"github.com/kidoman/embd" "github.com/kidoman/embd"
_ "github.com/kidoman/embd/host/rpi" _ "github.com/kidoman/embd/host/rpi" // This loads the RPi driver
) )
func main() { func main() {