Skip navigation
jc2048

PWM [micro:bit]

Posted by jc2048 Sep 22, 2016
I was curious as to whether I could use the micro:bit to generate PWM [pulse-width modulation] signals. At first I thought I'd have to find out how to control the processor's internal peripherals but it turned out that there was no need. Even the block language has instructions to do PWM on the output pins, though it's disguised by calling it an 'analog write' operation.   Here's a very simple program to set P0 to do PWM.       It works too. Here's what the oscillos ...
Never let it be said that us engineers don't do culture - the title is a quote from Shakespeare, just in case you don't recognise it [Love's Labour's Lost] - so I've come up with this light post in his honour and memory.   Now I know what the IO pin looks like (electrically) I can light up an LED. In fact it's trivial, because the series resistor on the board will do for the current limiting. So here we have a micro:bit flashing a red LED. (You'll have to trust me that it's flashing. I too ...
I am now the proud owner of a micro:bit. Yippee! I'm a bit old to be running around shouting "Yippee!" really, but why shouldn't us oldies have a bit of fun too.   Over on this thread,   https://www.element14.com/community/community/stem-academy/microbit/blog/2016/06/08/10-bbc-microbit-projects-in-10-days-day-three-making-music   jlucas suggested connecting an 8 ohm speaker to one of the IO pins. Instinctively, I flinched: 3.3V into 8 ohms would be a current of 413mA [if the IO ...