Skip to content

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.

License

crabbymonkey/nerf-controller

Repository files navigation

Nerf-Controller

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.

Getting Started

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.

Prerequisites

Installing

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.

  1. Create a StreamLabs API App
    1. Click the "Register An App" button.
    2. 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)
  2. Create a StreamLabsAPI.json file in the project home directory to have the correct information for the application you created.
    1. Example StreamLabsAPI.json:
      {
      "ClientID": "7FDyzIU5NPbDLJ0kvB5C5CYSay6VYxNoNmza0RW1",
      "ClientSecret": "wleRBri2UFhUFYBCdnDhOASgBm2uQ7H60vkC34hB",
      "RedirectURI": "http://localhost:8080/live"
      }
  3. (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.
    1. Example of setting the port to 3000 instead of 8080 using a bash comand
      PORT="3000"
      
  4. 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.

Running the tests

The tests are run using the make command make test in the project home directory.

Deployment

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.

Built With

  • Golang - Code Backend and Framework
  • StreamLabs - Donations Management
  • make - Code and Compilation Rules Management

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • Billie Thompson (PurpleBooth) - README.md and CONTRIBUTING.md templates used

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published