This code interfaces and run the web app GUI for an automated nerf gun that makes live stream donations into shots at the streamer. Designed to run on a Raspberry Pi Zero W connected to a nerf gun or other method of firing projectiles with a user interface via a web app, the program interfaces with StreamLabs to record donations that will add rounds to the hopper to be fired. The only projectiles to be used are safe to fire at humans such as the Nerf Rival Rounds or similar. Future iterations may have a 3D printable mechanism that can be used to fire the rounds, see the deployment section for more information.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
A step by step series of examples that explains how to get a development environment running. To build the system that will fire rounds see the Deployment section below.
- Create a StreamLabs API App
- Click the "Register An App" button.
- Fill out the information, most of the information dosen't matter except for Whitelist Users should be your StreamLabs username and Redirect URI should be http://localhost:8080/live (Note: replace the 8080 with whatever port you would like to use)
- Create a StreamLabsAPI.json file in the project home directory to have the correct information for the application you created.
- Example StreamLabsAPI.json:
{ "ClientID": "7FDyzIU5NPbDLJ0kvB5C5CYSay6VYxNoNmza0RW1", "ClientSecret": "wleRBri2UFhUFYBCdnDhOASgBm2uQ7H60vkC34hB", "RedirectURI": "http://localhost:8080/live" }
- Example StreamLabsAPI.json:
- (Optional) If you would like to change what port is used you can set the PORT environment veriable. by default the port used is 8080.
- Example of setting the port to 3000 instead of 8080 using a bash comand
PORT="3000"
- Example of setting the port to 3000 instead of 8080 using a bash comand
- The setup should now be complete the program can be tested and run with the following make command from the project home directory.
make all run
If correctly setup you should see the following in the console.
go fmt
go test -v ./...
=== RUN TestGetPort
--- PASS: TestGetPort (0.00s)
=== RUN TestHomeHandler
--- PASS: TestHomeHandler (0.00s)
=== RUN TestFireHandler
{Fri, 21 Dec 2018 22:54:35 EST} FIRE!!!
--- PASS: TestFireHandler (0.00s)
=== RUN TestTokenHandler
{Fri, 21 Dec 2018 22:54:35 EST} https://streamlabs.com/api/v1.0/authorize?client_id=7FDyzIU5NPbDLJ0kvB5C5CYSay6VYxNoNmza0RW1&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Flive&response_type=code&scope=donations.read
{Fri, 21 Dec 2018 22:54:35 EST} https://streamlabs.com/api/v1.0/authorize?client_id=7FDyzIU5NPbDLJ0kvB5C5CYSay6VYxNoNmza0RW1&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Flive&response_type=code&scope=donations.read
--- PASS: TestTokenHandler (0.00s)
=== RUN TestRandomPageHandler
Sorry but it seems this page does not exist...
Sorry but it seems this page does not exist...
Sorry but it seems this page does not exist...
--- PASS: TestRandomPageHandler (0.00s)
=== RUN TestFire
{Fri, 21 Dec 2018 22:54:35 EST} FIRE!!!
--- PASS: TestFire (0.00s)
=== RUN TestRandomValue
6
14
8
7
9
12
11
5
15
10
13
--- PASS: TestRandomValue (0.00s)
PASS
ok _/Users/rdufrene/work/nerf-contorller (cached)
go build -o nerf-controller -v
_/Users/rdufrene/work/nerf-contorller
go build -o nerf-controller -v ./...
./nerf-controller
Now listening to port :8080
Now visiting http://localhost:8080/ should display the user interface.
The tests are run using the make command make test
in the project home directory.
TODO: Development is still in progress so development on a live system is not ready yet.
How to use the application can be found here.
- Golang - Code Backend and Framework
- StreamLabs - Donations Management
- make - Code and Compilation Rules Management
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Ryan Dufrene - Initial work - crabbymonkey
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details
- Billie Thompson (PurpleBooth) - README.md and CONTRIBUTING.md templates used