Giter VIP home page Giter VIP logo

ncs-whack-a-mole's Introduction

NCS-Whack-A-Mole

Overview

This is a demo showcasing the multi link and multi role capabilities of the Nordic Bluetooth stacks, by implementing a simple game inspired by the old Whac-A-Mole arcade game where the user have to react quickly to the random appearance of "moles".

The demo consists of a central board which implements the main game logic, and a number of peripheral devices connected to it (normally based on the Thingy:52 hardware). Rather than having to hit a mole that pops up at random times the user has to press the button on the Thingy when the LED turns on, and the response time will be measured and sent back to the central controller. Additionally an Android app is provided to show the status of the game, and the controller board will connect to the Android device in the peripheral role, while being connected to the Thingy's as a central.

Requirements

  • nRF Connect SDK v2.2.0

Tested boards:

Central:

  • nrf52840dk_nrf52840
  • (most likely other nrf52 based DK's will work, but only the 52840dk is tested)

Peripheral:

  • thingy52_nrf52832
  • nrf52840dk_nrf52840
  • nrf5340dk_nrf5340_cpuapp

Running the demo

The central and peripheral applications need to be built as any other nRF Connect SDK application.

The central application must be flashed to the central board, and the peripheral application must be flashed to the various peripherals. In order to flash the Thingy:52 a 10-pin JLink cable will be needed, and a DK (such as the nRF52840DK) can be used as a programmer.

The demo has been tested with between 2-8 peripheral devices, and a minimum of 6 is recommended for a more challenging game.

The central board provides a simplified GUI through the UART terminal, in case an Android tablet is not available. To use this simply connect a terminal to the JLink comport set up by the controller board, and verify that there is output on the terminal when the controller boots.

In order to use the Android app this needs to be built manually and flashed into an Android device, based on this repository. After launching the app, connect to the central board which will advertise as "Whack-Central". The app uses UUID filtering to avoid showing other BLE advertisers, so normally there should only be one device to connect to.

The Thingy:52 peripherals will blink blue when not connected (advertising), and should turn off the LED once they are connected. The terminal interface will show the number of peripherals currently connected to the central. Once all the peripherals have connected a new game can be started by pressing a button on any of the peripherals.

From there on, simply follow the instructions in the terminal. The game will go through multiple rounds of increasing difficulty, and at the end of the game a final score will be displayed based on the performance of the player.

TODO

  • Implement a proper high score feature, to allow players to register their name and have the results stored permanently in the flash of the controller.

ncs-whack-a-mole's People

Contributors

ovrebekk avatar too1 avatar

Watchers

 avatar

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.