Skip to content

Instantly share code, notes, and snippets.

@ledongthuc
ledongthuc / bash
Created October 26, 2015 20:39
Golang get EMBD
go get github.com/kidoman/embd
@ledongthuc
ledongthuc / embd_buildin_light.go
Last active December 16, 2015 16:19
hello world, blink the buildin light
package main
import (
"time"
"github.com/kidoman/embd"
_ "github.com/kidoman/embd/host/rpi" // Loads the RPi driver
)
func main() {
@ledongthuc
ledongthuc / embd_buildin_light.go
Last active December 14, 2015 08:56
EMBD hello world, blink the buildin light
package main
import (
"time"
"github.com/kidoman/embd"
_ "github.com/kidoman/embd/host/all"
)
func main() {
@ledongthuc
ledongthuc / blink_led_embd.go
Created December 9, 2015 01:49
Blink the led with EMBD in Raspberry
import "github.com/kidoman/embd"
...
embd.InitGPIO()
defer embd.CloseGPIO()
...
pwm, _ := embd.NewPWMPin("P9_14")
defer pwm.Close()
...
pwm.SetDuty(1000)
import "github.com/kidoman/embd"
...
pin5 := 5
analogResult, err := embd.AnalogRead(pin5)
...
package main
import (
"fmt"
"io"
"net/http"
_ "github.com/mattes/migrate/driver/postgres"
"github.com/mattes/migrate/migrate"
)
CREATE TABLE users (
id integer NOT NULL,
name character varying(1000) DEFAULT ''::character varying NOT NULL,
age integer DEFAULT 0 NOT NULL,
password character varying(1000) DEFAULT ''::character varying NOT NULL,
email character varying(1000) DEFAULT ''::character varying NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL
);