Showing posts with label edublocks. Show all posts
Showing posts with label edublocks. Show all posts

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

Monday, 20 August 2018

Speech with EduBlocks on BBC microbit

The microbit is a great piece of kit, not least of which because of the range of programming languages and tools that can be used with it - officially JavaScript and Python and but there is also a range of third-party ones. A useful place to look for what languages/tools  are available is http://microbit.org/code-alternative-editors/; listing both official and third-party tools (there was a few I wasn't aware of ). One I was aware and meaning to play with, is the brilliant Edublocks by Josh Lowe (@all_about_code) or more  specifically in this post Edublocks for BBC Micro:bit (https://microbit.edublocks.org/).



Edublocks for the microbit (and Edublocks in general) allows graphical blocks of code, in a similar way to languages such as Scratch, to be dragged and dropped into places. That in itself would be great, but the really useful thing here is though, whilst doing it you are actually producing a Python program (technically in the microbit case micropython)- a good way (as others have said before e.g https://www.electromaker.io/blog/article/coding-the-bbc-microbit-with-edublocks ) of bridging the gap between block based programming tand text-based programming language (ie. Python). Added to this is the support for Python on the microbit and the things like speech, access the pins and neopixels you have a really useful and fun tool. 





Talk is cheap (sort of!)
The project shown here is getting the microbit to 'talk' using speech. I have attached a microbit to Pimoroni's noise bit for convenience (https://shop.pimoroni.com/products/noise-bit but equally, alligator wires and headphones could be used (https://www.microbit.co.uk/blocks/lessons/hack-your-headphones/activity ). The routine below allows when button A on the microbit is pressed the Microbit (through a speaker) to say Hello, B say Good bye and when both pressed Now what ? Simple but fun.



The equivalent Python code
They are essentially the same.


Here is a video of it in action:






Thoughts.

As you might have gathered I think this Edublocks for the microbit is a fantastic tool. I am planning my new experiments with it now- coming soon to this blog. Edublocks for the microbit is not all Edublocks can do, the project itself can be found at https://edublocks.org/ is well worth a look. For playing with the microbit for the first time with Python I would recommend Edublocks for the microbit  https://microbit.edublocks.org/


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

Remote Data Logging with V1 Microbit

In an earlier post  https://robotsandphysicalcomputing.blogspot.com/2024/08/microbit-v1-datalogging.html  a single microbit was used to log ...