Skip to main content

Posts

Showing posts with the label Gurdonark

Dancing pixels

In previous post I played with using the combination of the Proto-Pic Micro:pixel and Micro:Bit to react, using the accelerometer, to music through a computer speakers. The vibrations from the music shake the Micro:Bit enough to give measurable changes in three axis, and these values are used to change the pixels colour. The latest version of this uses most of pixels. Coded in micropython using the Mu editor . from microbit import * import neopixel, random np = neopixel.NeoPixel(pin0, 32) while True:     for pxl in range (2,32, 5):         rd=int(abs(accelerometer.get_x())/20)         gr=int(abs(accelerometer.get_y())/20)         bl=int(abs(accelerometer.get_z())/20)         np[pxl] = (rd, gr, 0)         np[pxl-1] = (rd, gr, 0)         np[pxl+1] = (0, gr, rd)         np[pxl-2] = (rd, 0, 0)       ...