2014-11-29 07:34:42 +08:00
|
|
|
# Edison
|
2014-09-19 03:45:54 +08:00
|
|
|
|
2023-06-05 00:36:55 +08:00
|
|
|
The Intel Edison is a WiFi and Bluetooth enabled development platform for the Internet of Things. It packs a robust set
|
|
|
|
of features into its small size and supports a broad spectrum of I/O and software support.
|
2014-09-19 03:45:54 +08:00
|
|
|
|
2014-11-29 07:34:42 +08:00
|
|
|
For more info about the Edison platform click [here](http://www.intel.com/content/www/us/en/do-it-yourself/edison.html).
|
2014-09-19 03:45:54 +08:00
|
|
|
|
2017-04-12 21:39:23 +08:00
|
|
|
## How to Install
|
2014-09-19 03:45:54 +08:00
|
|
|
|
2023-06-05 00:36:55 +08:00
|
|
|
Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md)
|
2015-07-11 03:48:02 +08:00
|
|
|
|
2017-04-12 21:39:23 +08:00
|
|
|
### Setting up your Intel Edison
|
2014-09-19 03:45:54 +08:00
|
|
|
|
2016-08-26 00:20:07 +08:00
|
|
|
Everything you need to get started with the Edison is in the Intel Getting Started Guide:
|
|
|
|
|
2023-06-05 00:36:55 +08:00
|
|
|
<https://software.intel.com/en-us/iot/library/edison-getting-started>
|
2016-08-26 00:20:07 +08:00
|
|
|
|
2015-11-05 02:32:34 +08:00
|
|
|
Don't forget to configure your Edison's wifi connection and flash your Edison with the latest firmware image!
|
2014-09-19 03:45:54 +08:00
|
|
|
|
2016-08-26 00:20:07 +08:00
|
|
|
The recommended way to connect to your device is via wifi, for that follow the directions here:
|
2014-09-19 03:45:54 +08:00
|
|
|
|
2023-06-05 00:36:55 +08:00
|
|
|
<https://software.intel.com/en-us/connecting-your-intel-edison-board-using-wifi>
|
2014-09-19 03:45:54 +08:00
|
|
|
|
2023-06-05 00:36:55 +08:00
|
|
|
If you don't have a wifi network available, the Intel documentation explains how to use another connection type, but note
|
|
|
|
that this guide assumes you are using wifi connection.
|
2015-07-11 03:48:02 +08:00
|
|
|
|
2016-08-26 00:20:07 +08:00
|
|
|
You can obtain the IP address of your Edison, by running the floowing command:
|
2014-11-29 07:34:42 +08:00
|
|
|
|
2023-06-05 00:36:55 +08:00
|
|
|
```sh
|
2016-08-26 00:20:07 +08:00
|
|
|
ip addr show | grep inet
|
2014-09-19 03:45:54 +08:00
|
|
|
```
|
|
|
|
|
2023-06-05 00:36:55 +08:00
|
|
|
Don't forget to setup the a password for the device otherwise you won't be able to connect using SSH. From within the screen
|
|
|
|
session, run the following command:
|
2014-11-29 07:34:42 +08:00
|
|
|
|
2023-06-05 00:36:55 +08:00
|
|
|
```ah
|
2015-07-11 03:48:02 +08:00
|
|
|
configure_edison --password
|
2014-09-19 03:45:54 +08:00
|
|
|
```
|
|
|
|
|
2015-07-11 03:48:02 +08:00
|
|
|
Note that you MUST setup a password otherwise SSH won't be enabled. If
|
|
|
|
later on you aren't able to scp to the device, try to reset the
|
|
|
|
password. This password will obviously be needed next time you connect to
|
|
|
|
your device.
|
2014-11-29 07:34:42 +08:00
|
|
|
|
2017-04-12 21:39:23 +08:00
|
|
|
## How To Use
|
2015-07-11 03:48:02 +08:00
|
|
|
|
2014-09-19 03:45:54 +08:00
|
|
|
```go
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2023-06-05 00:36:55 +08:00
|
|
|
"time"
|
2014-09-19 03:45:54 +08:00
|
|
|
|
2023-06-05 00:36:55 +08:00
|
|
|
"gobot.io/x/gobot/v2"
|
|
|
|
"gobot.io/x/gobot/v2/drivers/gpio"
|
|
|
|
"gobot.io/x/gobot/v2/platforms/intel-iot/edison"
|
2014-09-19 03:45:54 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2023-06-05 00:36:55 +08:00
|
|
|
e := edison.NewAdaptor()
|
|
|
|
led := gpio.NewLedDriver(e, "13")
|
|
|
|
|
|
|
|
work := func() {
|
|
|
|
gobot.Every(1*time.Second, func() {
|
2024-02-11 22:34:50 +08:00
|
|
|
if err := led.Toggle(); err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
}
|
2023-06-05 00:36:55 +08:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
robot := gobot.NewRobot("blinkBot",
|
|
|
|
[]gobot.Connection{e},
|
|
|
|
[]gobot.Device{led},
|
|
|
|
work,
|
|
|
|
)
|
|
|
|
|
2024-02-11 22:34:50 +08:00
|
|
|
if err := robot.Start(); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2014-09-19 03:45:54 +08:00
|
|
|
}
|
|
|
|
```
|
2014-11-29 07:34:42 +08:00
|
|
|
|
2023-05-20 20:25:21 +08:00
|
|
|
You can read the [full API documentation online](http://godoc.org/gobot.io/x/gobot/v2).
|
2015-07-11 03:48:02 +08:00
|
|
|
|
2017-04-12 21:39:23 +08:00
|
|
|
## How to Connect
|
2015-07-11 03:48:02 +08:00
|
|
|
|
2017-04-12 21:39:23 +08:00
|
|
|
### Compiling
|
2015-07-11 03:48:02 +08:00
|
|
|
|
2017-04-12 21:39:23 +08:00
|
|
|
Compile your Gobot program on your workstation like this:
|
2015-07-11 03:48:02 +08:00
|
|
|
|
2023-06-05 00:36:55 +08:00
|
|
|
```sh
|
|
|
|
GOARCH=386 GOOS=linux go build examples/edison_blink.go
|
2015-07-11 03:48:02 +08:00
|
|
|
```
|
|
|
|
|
2023-06-05 00:36:55 +08:00
|
|
|
Once you have compiled your code, you can you can upload your program and execute it on the Intel Edison from your workstation
|
|
|
|
using the `scp` and `ssh` commands like this:
|
2015-07-11 03:48:02 +08:00
|
|
|
|
2023-06-05 00:36:55 +08:00
|
|
|
```sh
|
|
|
|
scp edison_blink root@<IP of your device>:/home/root/
|
|
|
|
ssh -t root@<IP of your device> "./edison_blink"
|
2015-07-11 03:48:02 +08:00
|
|
|
```
|
|
|
|
|
2017-04-12 21:39:23 +08:00
|
|
|
At this point you should see one of the onboard LEDs blinking. Press control + c
|
2015-07-11 03:48:02 +08:00
|
|
|
to exit.
|
|
|
|
|
|
|
|
To update the program after you made a change, you will need to scp it
|
|
|
|
over once again and start it from the command line (via screen).
|