Skip to main content

Posts

Showing posts with the label leds

Hug Avoider 3 - experiments with Python and 4Tronix Eggbit

via GIPHY 4Tronix's Eggbit (in fact I bought three of them  https://shop.4tronix.co.uk/collections/bbc-micro-bit/products/eggbit-three-pack-special   :-) recently) is a cute add-on for the microbit (see above).  In two previous posts I looked at eggbit using microcode to  produce a hug avoider - warns when people at too close. - https://robotsandphysicalcomputing.blogspot.com/2021/12/hug-avoider-2-4tronix-eggbit.html -  4tronix Eggbit - cute and wearable - hug avoider This post replicates  some of this, but this time using Python and shows the stages of the build Get the ultrasound to find the distance; Produce smile and surprise on the eggbit's 'mouth'; Produce rainbow on the neopixels or all the pixels turning red; Bring it all together so if the person is too close, less than 30cm it reacts.   1. Ultrasonic detection Probably the most challenging bit of this was getting the ultrasonic distance measrement working. It actually is not that difficult; e...

kitronik :Move mini buggy (Python control of LEDs)

In two previous posts I looked at control the :Move buggy using JavaScript Blocks or Python . In this post we are going to look at controlling the LEDs using Python (or more accurately micropython). Pin 0 controls the LEDs, they are based on 5   NeoPixel compatible,  RGB, addressable LEDs; so the Neopixel protocols (and library for Neopixels) can be used.  Code First five colours of the rainbow. The array lig  holds the RGB settings for the rainbow colours (more details on the RGB colours can be found at  Lorraine Underwood 's Halloween Cloud project ). In the code below, the five LEDs have a different colour allocated to them. from microbit import * import neopixel np = neopixel.NeoPixel(pin0, 5) lig=[[255,0,0],[255,127,0],[255,255,0],[0,255,0],[0,0,255],[75,0,136],[139,0,255]] while True:     np[0] = lig[0]     np[1] = lig[1]     np[2] = lig[2]     np[3] = lig[3] ...

UFO has landed

CBiS Education generously sent me two of their new range of robotics development kits - BinaryBots ( https://www.binarybots.co.uk/makers.aspx ), these are a range of cardboard based kits (so far a robot and a UFO) with electronic components for example LEDs; sensors and buzzers,  depending on the kits. What makes the kits interesting though is they are designed to be controlled by either by a BBC Micro:bit or a CodeBug. This blog documents, briefly, an initial play with the UFO kit (see below) using a Micro:Bit for control.  The UFO model  came together readily, the instructions were fairly easy to follow. Personally, a feature I especially liked about the model was the LEDs being both on the top and bottom of it - increasing its usefulness. CBiS EducationThey have also provided a webpage / portal with some example projects and code.  My first project I built, was to pulse the LEDs on and off (one set of LEDs on Pin 0, the other on Pin 1). ...

Traffic lights - Microbit, GlowBugs and micropython

In a previous post, I got a GlowBug to work with a micro:bit ( http://robotsandphysicalcomputing.blogspot.co.uk/2016/08/microbit-and-glowbug.html ) . In this post, I will show a relatively simple traffic lights system produced by turning off and on the pixels via a micro:bit. Code from microbit import * import neopixel # Setup the Neopixel strip on pin0 with a length of 3 pixels np = neopixel.NeoPixel(pin0, 3) while True:     #red     np[0] = (255, 0, 0)     np[1] = (0,0, 0)     np[2] = (0,0,0)     np.show()     sleep(1000)     #red and orange     np[0] = (255, 0, 0)     np[1] = (255, 69, 0)     np[2] = (0,0,0)     np.show()     sleep(1000)     #green only     np[0] = (0, 0, 0)     np[1] = (0, 0, 0)     np[2] = (0,255,0)     np.show()     sleep(1000)   ...