GithubHelp home page GithubHelp logo

mkleinsb / cubebitv0core Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 4tronix/cubebit

0.0 1.0 0.0 23 KB

MakeCode package for 4tronix Cube:Bit RGB Cubes

License: MIT License

TypeScript 100.00%

cubebitv0core's Introduction

MakeCode Package for 4tronix Cube:Bit Magical RGB Cubes of Awesome

Helper routines for using the neopixels in the Cube:Bit range of Cubes https://4tronix.co.uk/cubebit/.

Defining the Cube

The first thing you should do is create a Cube object with the required dimensions per side. Use the block:

create cube:bit on pin0 with side <3/4/5/6/7/8>

Then set the brightness to be used from 0 to 255. If this block is not used, then the brightness is set to 40. We strongly recommend keeping this at less than 100. All values sent to the LEDs after this command will be scaled down to fit in this maximum brightness level.

set cube:bit brightness to <0..255>

##Using Cube:Bit Pixels Each pixel can be addressed by using the pixel ID which is a number from 0 to the number of pixels in the cube minus one. eg. a 3x3x3 cube has 27 pixels so the ID can be 0 to 26, 4x4x4 has 64 (ID 0 to 63) and 5x5x5 has 125 (ID 0 to 124)

set pixel color at ID to <colour>

The colour value is a number. There are some pre-define colours (eg. Red, Yellow, etc) or you can put in a simple number, or you can define separate Red, Green and Blue values using the map colour block

convert from red, green, blue

If you want to specify the x,y,z position of the pixel then use the mapping block to create the pixel ID

map from x y x

Whenever changing the colour of pixels or clearing them, or rotating them, you will need to display the result afterwards. Use the show changes block for this

show Cube:Bit changes

You can also set a whole plane of pixels to the same colour. eg. set the top slice to blue, or the left side to green. Use the set plane block:

set plan <number> on axis <xy, xz, yz> to <colour>

Supported targets

  • for PXT/microbit

License

Apache 2.0

cubebitv0core's People

Contributors

4tronix avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.