IoT Challenge 1
Revision 15:c1e95fe32630, committed 2020-02-10
- Comitter:
- jeffloh33
- Date:
- Mon Feb 10 13:33:15 2020 +0000
- Parent:
- 14:4b89e7e3494f
- Commit message:
- Paper, scissors & rock;
Changed in this revision
README.md | Show annotated file Show diff for this revision Revisions of this file |
--- a/README.md Wed Jul 13 14:33:05 2016 +0000 +++ b/README.md Mon Feb 10 13:33:15 2020 +0000 @@ -1,42 +1,39 @@ -# microbit +## Project Title +Paper, Scissors and Rock -A collection of the commonly used components of the micro:bit runtime with a -standard configuration, to provide an easy to use interface for programming the micro:bit in C/C++. -## Overview +## Getting Started +Button A is used for the counting score function +Button B is used for display Paper, Scissors and Rock in randomly + -The micro:bit runtime provides an easy to use environment for programming the BBC micro:bit in the C/C++ language, written by Lancaster University. It contains device drivers for all the hardware capabilities of the micro:bit, and also a suite of runtime mechanisms to make programming the micro:bit easier and more flexible. These range from control of the LED matrix display to peer-to-peer radio communication and secure Bluetooth Low Energy services. The micro:bit runtime is proudly built on the ARM mbed and Nordic nrf51 platforms. +## How to play the game +This game need to play by 2 players and each player hold one Micro:Bit. Players press the buttonB to randomly +show Paper, Scissor & Rock. The player who won the round, press buttonA to add the score. The player who reach +5 score first win the game. -In addition to supporting development in C/C++, the runtime is also designed specifically to support higher level languages provided by our partners that target the micro:bit. It is currently used as a support library for all the languages on the BBC www.microbit.co.uk website, including Microsoft Block, Microsoft TouchDevelop, Code Kingdoms JavaScript and Micropython languages. -## Links - -[micro:bit runtime docs](http://lancaster-university.github.io/microbit-docs/) | [microbit-dal](https://github.com/lancaster-university/microbit-dal) | [samples](https://github.com/lancaster-university/microbit-samples) +## Examples +P1 and P2 press buttonB. P1's MicroBit display Scissors, and P2's MicroBit display Rock. So, P2 win the first +round. P2 press buttonA to add 1 score. +Then, both players press buttonB again for the next round. P1 shows Rock and P2 shows scissors. P1 press +buttonA to add score. +Round 3, P1 get scissors and P2 get Paper. P1 press buttonA to add score. Now P1 got 2 scores and P2 got 1. +The player reach 5 scores first win the game. + -## Build Environments +## How to build it +This simple mini game is build by c++ language. Some simple if statement are used to display something when +player press the buttons. A random function is also used to generate a random number between 1-3 in this game, +if the random number is 1, it will display a Scissors image on MicroBit, number 2 will display Rock image and number +3 display Paper image. A counting function used to count the player's score. The count will automatically add 1 +when player pressed buttonA and then display a win message when the score is 5. -| Build Environment | Documentation | -| ------------- |-------------| -| ARM mbed online | http://lancaster-university.github.io/microbit-docs/online-toolchains/#mbed | -| yotta | http://lancaster-university.github.io/microbit-docs/offline-toolchains/#yotta | + +## Built With +* Mbed Compiler +* c++ programming language +* BBC Micro:Bit -## Hello World! - -```cpp -#include "MicroBit.h" - -MicroBit uBit; - -int main() -{ - uBit.init(); - - uBit.display.scroll("Hello world!"); -} -``` - -## BBC Community Guidelines - -[BBC Community Guidelines](https://www.microbit.co.uk/help#sect_cg)