The purpose of this package is to programmatically control the GPIO pins on a Raspberry Pi. In doing so children and adults of all ages can make crazy robots that do all manner of crazy things.
All the parts to make a robot that runs the code in this package can be ordered from amazon for around a $105;
- Raspberry Pi 3 Model B
- Robot Car Chassis
- L293D Stepper Motor Driver
- IR Infrared Obstacle Avoidance Sensor
- Solderless BreadBoard
- Jumper Wires
- USB Portable Charger
This however this is not just an expensive robot. It's a whole computer! Plug in a TV and keyboard then you're all setup to code the ultimate robot. Or play music, videos, games, whatever you young folk do these days.
Optional parts for more fun;
UNSTABLE: This package is under active development.
All the source code is commented and also available as online documentation.
There are working code examples of each supported controllable device.
A complete program for a basic line following robot can be found here.
You will need to create a SSD with Raspbian Jesse Lite. Follow the Raspberry Pi instructions on how to install an operating system.
It's a good idea to use a Secure Shell when working with your robot but not required.
After logging on to the Raspberry Pi execute the following commands;
sudo apt-get install git
sudo apt-get install golang
mkdir ~/robot
cd ~/robot
Add the environment variables for using Go;
export PATH=$PATH:$GOROOT/bin
export GOPATH=$HOME/robot
export PATH=$PATH:$GOPATH/bin
Get the Engine from Github;
go get github.com/ricallinson/simplebdd
go get github.com/ricallinson/engine
export PATH=$PATH:$GOROOT/bin
export GOPATH=$HOME/robot
export PATH=$PATH:$GOPATH/bin
cd ~/robot
go get -u github.com/ricallinson/engine
cd ~/robot/src/github.com/ricallinson/engine
go test -v -cover ./...
Source code for LED example.
cd ~/robot/src/github.com/ricallinson/engine/examples/led-flash
go install
led-flash
Source code for LED with Pulse Width Modulation example.
cd ~/robot/src/github.com/ricallinson/engine/examples/led-pwm
go install
led-pwm
Note: This has only been tested on one pin.
Source code for IRSensor example.
cd ~/robot/src/github.com/ricallinson/engine/examples/ir-sensor
go install
ir-sensor
Source code for RangeSensor example. Requires optional parts to complete.
cd ~/robot/src/github.com/ricallinson/engine/examples/range-sensor
go install
range-sensor
Source code for Motor example.
cd ~/robot/src/github.com/ricallinson/engine/examples/motor
go install
motor
Source code for Line Follower example.
cd ~/robot/src/github.com/ricallinson/engine/examples/line-follower
go install
line-follower
Run a packages tests and generate its coverage report with a HTML viewer;
cd ~/robot/src/github.com/ricallinson/engine
go test -covermode=count -coverprofile=count.out; go tool cover -html=count.out