GithubHelp home page GithubHelp logo

crabbymonkey / nerf-controller Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 2.0 8.33 MB

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: MIT License

Makefile 2.54% Go 53.39% HTML 26.97% CSS 17.10%
raspberry-pi nerf-contorller golang streaming streamlabs donations live-streaming nerf nerf-gun webapp

nerf-controller's Introduction

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

nerf-controller's People

Contributors

crabbymonkey avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nerf-controller's Issues

Add Raspberry Pi Logic

Add the logic to the code that will send the correct commands to the raspberry pi to fire the nerf gun.

Add Raspberry Pi Integration

Find a Raspberry Pi Golang lib that allows us to connect to the raspberry pi pins so we can send commands to fire the nerf gun.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.