Skip to content

slowteetoe/dashbutton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fun with Dash buttons

dash buttons

Inspired by this article, but since I have an Intel Edison lying around, and I can compile a binary for the Edison in Go... I'm doing it in Go.

Eventually (or maybe not that long from now) this will allow me to trigger events in the real world, basically anything that I can hook up to an Edison (which means all Arduino/Seed/etc boards) using the awesome gobot framework.

First Time Setup

  1. Follow the instructions that came with your Dash button, but in the final step, do NOT pick the actual product you want to replenish. Just close the shopping app instead.

  2. Run the util/identify.go script - you'll most likely (definitely?) need to run it as root: sudo GOPATH=/your/go/path go run identify.go -inf=eth0 (you can use the inf flag to specify which interface you want to listen on)

  3. Press the Dash button - you should see something like: SourceMAC[de:ad:be:ef:01:02]

  4. Save this MAC address, it's how your Dash button will be identified.

Compiling for the Edison

This was a bit of a pain, at least on a Mac. See this blog post for details, if you want. Otherwise, you just need something like:

GOARCH=386 CGO_ENABLED=1 go build --ldflags '-extldflags "-static"' listen.go

Usage

  1. Implement whatever you want the button presses to do (there are empty functions in listen.go that handle the button presses)
  2. Run listen.go (as root)
  3. Press the Dash button
  4. Yay!

TODO

  • Allow setting up the MAC addresses dynamically?
  • Hook up the gobot stuff (toggle LEDs to start)
  • Make sure it works on an Edison
  • Try a digispark?

Example output:

2015/08/30 12:07:31 Starting up on interface[en0]...
2015/08/30 12:07:31 Listening for Dash buttons...
2015/08/30 12:08:13 Pressed the Glad button.
2015/08/30 12:09:08 Pressed the Gatorade button.
2015/08/30 12:10:19 Pressed the Gatorade button.
2015/08/30 12:11:03 Pressed the Glad button.
2015/08/30 12:11:08 Pressed the Gatorade button.
2015/08/30 12:11:23 Pressed the Glad button.
2015/08/30 12:11:26 Pressed the Gatorade button.

Video of the LED code in action

Go Report Card

About

App to control real-world events from a Dash button

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages