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

Nicholas H.Tollervey ntoll at ntoll.org
Wed Feb 10 13:31:11 EST 2016


Hi Nevil,

What Damien said... :-)

Really looking forward to seeing what you come up with. Is the source
code anywhere?

N.

On 10/02/16 17:09, Nevil Hunt wrote:
> Hi Nicholas,
>  
> I tried a bit of Beethoven from the Python Library which worked fine!
> Looking at it on the Scope it is still generated as a square wave.
> I've a feeling that the "Analog" outputs on the micro:bit are in fact
> PWM outputs so tones are generated by a PWM square wave of the
> appropriate frequency.
> If so then playing, say a .WAV file may not be possible.
> Does anyone know if the analog outputs can generate a genuine analog
> audio signal?
>  
> Nevil
>  
> To: microbit at python.org
> From: ntoll at ntoll.org
> Date: Mon, 8 Feb 2016 20:02:26 +0000
> Subject: Re: [Microbit-Python] Microbit-Python “Simon Says” Example for
> Kitronik Inventor’s Kit
> 
> Nevil,
>  
> We have a whole music module... See:
>  
> http://microbit-micropython.readthedocs.org/en/latest/music.html
>  
> :-)
>  
> Happy to answer questions.
>  
> N.
>  
> On 08/02/16 16:10, Nevil Hunt wrote:
>> Hi Damien,
>>  
>> The Inventor's Kit comes with a Piezo Buzzer since as it can be driven
>> directly from the P0 output pin.
>> A proper 8 ohm speaker needs an amp chip to drive it and as far as that
>> is concerned watch this space!
>> Looking on the 'scope, when I generate a note from Block it generates
>> more-or-less a square wave. Do you have the ability to generate proper
>> tunes using micro python?
>> Nicholas said there were memory limitations in playing .wav files
>> like you can using Python on the Raspberry Pi.
>> If you have anything that works using micro python I would quite like to
>> give it a go!
>>  
>> Regards,
>>  
>> Nevil
>>  
>>> Date: Sun, 7 Feb 2016 23:10:07 +0000
>>> From: damien.p.george at gmail.com
>>> To: microbit at python.org
>>> Subject: Re: [Microbit-Python] Microbit-Python “Simon Says” Example
>> for Kitronik Inventor’s Kit
>>>
>>> Hi Nevil,
>>>
>>> Does the inventor's kit have a proper speaker (not just a buzzer)? If
>>> so when we can be even more creative with MicroPython and play tunes
>>> and notes through it.
>>>
>>> Cheers,
>>> Damien.
>>>
>>>
>>> On Sun, Feb 7, 2016 at 12:27 PM, Nicholas H.Tollervey
>> <ntoll at ntoll.org> wrote:
>>> > Hi Nevil,
>>> >
>>> > Just a quick correction: it's Damien George who should be getting all
>>> > the thanks - he's the creator of MicroPython and has put in a huge
>>> > amount of work on this project.
>>> >
>>> > Without Damien we wouldn't have Python on the micro:bit.
>>> >
>>> > N.
>>> >
>>> > On 07/02/16 12:19, Nevil Hunt wrote:
>>> >>
>>> >>
>>> >> 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 <http://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
>>> >>
>>> >>
>>> >>
>>> >> _______________________________________________
>>> >> Microbit mailing list
>>> >> Microbit at python.org
>>> >> https://mail.python.org/mailman/listinfo/microbit
>>> >>
>>> >
>>> >
>>> >
>>> > _______________________________________________
>>> > Microbit mailing list
>>> > Microbit at python.org
>>> > https://mail.python.org/mailman/listinfo/microbit
>>> >
>>> _______________________________________________
>>> Microbit mailing list
>>> Microbit at python.org
>>> https://mail.python.org/mailman/listinfo/microbit
>> 
>> 
>> _______________________________________________
>> Microbit mailing list
>> Microbit at python.org
>> https://mail.python.org/mailman/listinfo/microbit
>> 
>  
>  
> 
> 
> _______________________________________________ Microbit mailing list
> Microbit at python.org https://mail.python.org/mailman/listinfo/microbit
> 
> 
> _______________________________________________
> Microbit mailing list
> Microbit at python.org
> https://mail.python.org/mailman/listinfo/microbit
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/microbit/attachments/20160210/430f8577/attachment.sig>


More information about the Microbit mailing list