[Microbit-Python] Microbit-Python “Simon Says” Example for Kitronik Inventor’s Kit

Nevil Hunt nevil.hunt at hotmail.co.uk
Sun Feb 7 07:19:38 EST 2016


 

Hi,

 

First of all I’d like to thank Nicholas for the Micro-Python
initiative and Andrew Mulholland (who I met at the BETT show and who showed me
how to get going with Microbit-Python). I am a STEM Ambassador and I’m working
with one of the micro:bit partner companies, Kitronik, helping to get their resources
ready for the roll out of the micro:bit into schools. In particular I’ve been
helping get their “Inventor’s Kit” ready. The Inventor’s Kit allows the micro:bit
to connect to a Breadboard then comes with various electronic components (switches,
LEDs, buzzers, motors, pots, etc) to experiment with connecting electronics to
the micro:bit. The booklet that comes with the Kit has 10 experiments along
with the code to drive them. Four use ‘Block’ and six use ‘Touch’ but our plan
is to publish many more on the web site (www.kitronik.co.uk/microbit) We
would like some of these to use Java and some to use Python. As you might
imagine, things are quite busy. I am now up and running with Microbit-Python
but I have limited time to write the example code so I thought I’d see if
anyone on this forum fancied having a go! 

The first one we have in mind is a “Simon Says” game where
the Breadboard is fitted with 4 push switches (A,B,C,D) and a buzzer (see
attached). Using the 4 corner LEDs of the micro:bit as the A,B,C,D lights the
game starts by illuminating one random corner of the display e.g. ‘B’ and
playing the note ‘B’ on the buzzer via P0. The player then has match this by pressing
switch ‘B’ which illuminates ‘B’ and plays the note ‘B’. The game then
illuminates ‘B’ plus one more random corner, e.g. ‘D’ while playing note ‘D’ on
the buzzer. The player then has match this by pressing switches ‘B’ and ‘D’ in
sequence. The game continues by adding another random letter to the sequence,
e.g. ‘B’ ‘D’ ‘A’ then ‘B’ ‘D’ ‘A’ ‘B’ then ‘B’ ‘D’ ‘A’ ‘B’ ‘C’ etc with the
score being the maximum length of sequence the player correctly repeats. The
game ends when the player fails to match the sequence. 

So if you fancy having a go, post me the code and I will try
it out. Since you are unlikely to have an Inventor’s Kit you could try writing
a simpler 2 switch version of the game using the ‘A’ and ‘B’ buttons on the micro:bit.

 

Regards,

 

Nevil Hunt

STEM Ambassador

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/microbit/attachments/20160207/1c1127f4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Kitronik_Inventors_Kit_SimonSays_CctDiagram.jpg
Type: image/jpeg
Size: 206339 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/microbit/attachments/20160207/1c1127f4/attachment-0001.jpg>


More information about the Microbit mailing list