Tuesday 23 April 2019

Combining Beta Edublocks and Microbit Playground

I have recently been playing with Edublocks (edublocks.org) and the 4tronix's Microbit Playground (the appropriately named Super Kit) controlling programmable pixels/neopixels  and a servo.





Recently a beta version of the Edublocks (see above) has become available (https://app.edublocks.org/) so I wanted to play with it a bit and, at the same time, combine control the servo motor and neopixels together via a potentiometer (see below).





The block version of the code is shown below:




The python version
np = None
port1 = None
pot2 = None
port3 = None


from microbit import *
import neopixel
np = neopixel.NeoPixel(pin0, 8)
pin2.set_analog_period(20)# your own code
while True:
  port1 = pin1.read_analog()
  pot2 = port1//128
  port3 = port1//8
  np[pot2] = (255, 0, 128)
  np.show()
  pin2.write_analog(port3)
  sleep(250)
  np.clear()

To see it action



via GIPHY


A few thoughts on the beta version, I actually like it more than the current version for doing this kind of activity. I found it clearer to use,  it was easier to know what was needed to be done with blocks around the neopixels than the previous version, which needed a little more thought.







All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

1 comment:

Top posts on this blog in March 2024

The Top 10 viewed post on this blog in March 2024. Covering areas such as small robots, augmented reality, Scratch programming, robots. Micr...