Skip to content

Commit

Permalink
examples: firmata examples take command line param for port to use to…
Browse files Browse the repository at this point in the history
… microcontroller

Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Jul 13, 2017
1 parent 388e7ad commit 4c834e7
Show file tree
Hide file tree
Showing 28 changed files with 282 additions and 27 deletions.
10 changes: 9 additions & 1 deletion examples/firmata_blink.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@
//
// Do not build by default.

/*
How to run
Pass serial port to use as the first param:
go run examples/firmata_blink.go /dev/ttyACM0
*/

package main

import (
"fmt"
"os"
"time"

"gobot.io/x/gobot"
Expand All @@ -14,7 +22,7 @@ import (
)

func main() {
firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0")
firmataAdaptor := firmata.NewAdaptor(os.Args[1])
led := gpio.NewLedDriver(firmataAdaptor, "13")

work := func() {
Expand Down
10 changes: 9 additions & 1 deletion examples/firmata_blinkm.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@
//
// Do not build by default.

/*
How to run
Pass serial port to use as the first param:
go run examples/firmata_blinkm.go /dev/ttyACM0
*/

package main

import (
"fmt"
"os"
"time"

"gobot.io/x/gobot"
Expand All @@ -14,7 +22,7 @@ import (
)

func main() {
firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0")
firmataAdaptor := firmata.NewAdaptor(os.Args[1])
blinkm := i2c.NewBlinkMDriver(firmataAdaptor)

work := func() {
Expand Down
11 changes: 10 additions & 1 deletion examples/firmata_button.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,25 @@
//
// Do not build by default.

/*
How to run
Pass serial port to use as the first param:
go run examples/firmata_button.go /dev/ttyACM0
*/

package main

import (
"os"

"gobot.io/x/gobot"
"gobot.io/x/gobot/drivers/gpio"
"gobot.io/x/gobot/platforms/firmata"
)

func main() {
firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0")
firmataAdaptor := firmata.NewAdaptor(os.Args[1])

button := gpio.NewButtonDriver(firmataAdaptor, "2")
led := gpio.NewLedDriver(firmataAdaptor, "3")
Expand Down
10 changes: 9 additions & 1 deletion examples/firmata_buzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
//
// Do not build by default.

/*
How to run
Pass serial port to use as the first param:
go run examples/firmata_buzzer.go /dev/ttyACM0
*/

package main

import (
"os"
"time"

"gobot.io/x/gobot"
Expand All @@ -13,7 +21,7 @@ import (
)

func main() {
firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0")
firmataAdaptor := firmata.NewAdaptor(os.Args[1])
buzzer := gpio.NewBuzzerDriver(firmataAdaptor, "3")

work := func() {
Expand Down
10 changes: 9 additions & 1 deletion examples/firmata_cat_toy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@
//
// Do not build by default.

/*
How to run
Pass serial port to use as the first param:
go run examples/firmata_cat_toy.go /dev/ttyACM0
*/

package main

import (
"fmt"
"os"
"time"

"gobot.io/x/gobot"
Expand All @@ -15,7 +23,7 @@ import (
)

func main() {
firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0")
firmataAdaptor := firmata.NewAdaptor(os.Args[1])
servo1 := gpio.NewServoDriver(firmataAdaptor, "5")
servo2 := gpio.NewServoDriver(firmataAdaptor, "3")

Expand Down
10 changes: 9 additions & 1 deletion examples/firmata_curie_imu.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@
//
// Do not build by default.

/*
How to run
Pass serial port to use as the first param:
go run examples/firmata_curie_imu.go /dev/ttyACM0
*/

package main

import (
"log"
"os"
"time"

"gobot.io/x/gobot"
Expand All @@ -15,7 +23,7 @@ import (
)

func main() {
firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0")
firmataAdaptor := firmata.NewAdaptor(os.Args[1])
led := gpio.NewLedDriver(firmataAdaptor, "13")
imu := curie.NewIMUDriver(firmataAdaptor)

Expand Down
10 changes: 9 additions & 1 deletion examples/firmata_curie_imu_shock_detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@
//
// Do not build by default.

/*
How to run
Pass serial port to use as the first param:
go run examples/firmata_curie_imu_shock_detect.go /dev/ttyACM0
*/

package main

import (
"log"
"os"
"time"

"gobot.io/x/gobot"
Expand All @@ -15,7 +23,7 @@ import (
)

func main() {
firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0")
firmataAdaptor := firmata.NewAdaptor(os.Args[1])
led := gpio.NewLedDriver(firmataAdaptor, "13")
imu := curie.NewIMUDriver(firmataAdaptor)

Expand Down
10 changes: 9 additions & 1 deletion examples/firmata_curie_imu_step_counter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@
//
// Do not build by default.

/*
How to run
Pass serial port to use as the first param:
go run examples/firmata_curie_imu_step_counter.go /dev/ttyACM0
*/

package main

import (
"log"
"os"
"time"

"gobot.io/x/gobot"
Expand All @@ -15,7 +23,7 @@ import (
)

func main() {
firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0")
firmataAdaptor := firmata.NewAdaptor(os.Args[1])
led := gpio.NewLedDriver(firmataAdaptor, "13")
imu := curie.NewIMUDriver(firmataAdaptor)

Expand Down
10 changes: 9 additions & 1 deletion examples/firmata_curie_imu_tap_detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@
//
// Do not build by default.

/*
How to run
Pass serial port to use as the first param:
go run examples/firmata_curie_imu_tap_detect.go /dev/ttyACM0
*/

package main

import (
"log"
"os"
"time"

"gobot.io/x/gobot"
Expand All @@ -15,7 +23,7 @@ import (
)

func main() {
firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0")
firmataAdaptor := firmata.NewAdaptor(os.Args[1])
led := gpio.NewLedDriver(firmataAdaptor, "13")
imu := curie.NewIMUDriver(firmataAdaptor)

Expand Down
10 changes: 9 additions & 1 deletion examples/firmata_direct_pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
//
// Do not build by default.

/*
How to run
Pass serial port to use as the first param:
go run examples/firmata_direct_pin.go /dev/ttyACM0
*/

package main

import (
"os"
"time"

"gobot.io/x/gobot"
Expand All @@ -13,7 +21,7 @@ import (
)

func main() {
firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0")
firmataAdaptor := firmata.NewAdaptor(os.Args[1])
pin := gpio.NewDirectPinDriver(firmataAdaptor, "13")

work := func() {
Expand Down
10 changes: 9 additions & 1 deletion examples/firmata_hmc6352.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@
//
// Do not build by default.

/*
How to run
Pass serial port to use as the first param:
go run examples/firmata_hmc6352.go /dev/ttyACM0
*/

package main

import (
"fmt"
"os"
"time"

"gobot.io/x/gobot"
Expand All @@ -14,7 +22,7 @@ import (
)

func main() {
firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0")
firmataAdaptor := firmata.NewAdaptor(os.Args[1])
hmc6352 := i2c.NewHMC6352Driver(firmataAdaptor)

work := func() {
Expand Down
10 changes: 9 additions & 1 deletion examples/firmata_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@
//
// Do not build by default.

/*
How to run
Pass serial port to use as the first param:
go run examples/firmata_integration.go /dev/ttyACM0
*/

package main

import (
"fmt"
"os"
"time"

"gobot.io/x/gobot"
Expand All @@ -15,7 +23,7 @@ import (
)

func main() {
firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0")
firmataAdaptor := firmata.NewAdaptor(os.Args[1])
led1 := gpio.NewLedDriver(firmataAdaptor, "3")
led2 := gpio.NewLedDriver(firmataAdaptor, "4")
button := gpio.NewButtonDriver(firmataAdaptor, "2")
Expand Down
10 changes: 9 additions & 1 deletion examples/firmata_led_brightness.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
//
// Do not build by default.

/*
How to run
Pass serial port to use as the first param:
go run examples/firmata_led_brightness.go /dev/ttyACM0
*/

package main

import (
"os"
"time"

"gobot.io/x/gobot"
Expand All @@ -13,7 +21,7 @@ import (
)

func main() {
firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0")
firmataAdaptor := firmata.NewAdaptor(os.Args[1])
led := gpio.NewLedDriver(firmataAdaptor, "3")

work := func() {
Expand Down
10 changes: 9 additions & 1 deletion examples/firmata_led_brightness_with_analog_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@
//
// Do not build by default.

/*
How to run
Pass serial port to use as the first param:
go run examples/firmata_led_brightness_with_analog_input.go /dev/ttyACM0
*/

package main

import (
"fmt"
"os"

"gobot.io/x/gobot"
"gobot.io/x/gobot/drivers/aio"
Expand All @@ -14,7 +22,7 @@ import (
)

func main() {
firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0")
firmataAdaptor := firmata.NewAdaptor(os.Args[1])
sensor := aio.NewAnalogSensorDriver(firmataAdaptor, "0")
led := gpio.NewLedDriver(firmataAdaptor, "3")

Expand Down
Loading

0 comments on commit 4c834e7

Please sign in to comment.