Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Maker Makecode and CPX/CPB
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Maker Makecode and CPX/CPB

by V2man on Fri Feb 21, 2020 11:40 am

I just tried the java code below in Maker Makecode in both CPX and CPB. It works for this code! It use two external NeoPixel Ring - 12 x 5050 RGB LED with Integrated Drivers PRODUCT ID: 1643
Copy your Makecode Java script code or text into Maker Makecode Java script window to try out different codes. Then switch to Blocks. Right click Format Code to arrange Blocks before making a manual correction.

Code: Select all | TOGGLE FULL SIZE
function STRIPcolors () {
    for (let index = 0; index <= strip1.length() - 1; index++) {
        Scolor[index] = light.hsv(index * 16, 255, 255)
    }
    pause(1000)
}
/**
 * CPX-Xstripx2-Array
 */
let np = 0
let Scolor: number[] = []
let strip1: light.NeoPixelStrip = null
let strip = light.createStrip(pins.A1, 24)
strip1 = strip.range(0, 6)
let strip2 = strip.range(6, 6)
let strip3 = strip.range(13, 6)
let strip4 = strip.range(19, 6)
strip.setBrightness(20)
STRIPcolors()
forever(function () {
    np = 0
    Scolor.reverse()
    for (let value of Scolor) {
        strip.setAll(0x000000)
        strip1.setPixelColor(np, value)
        strip2.setPixelColor(np, value)
        strip3.setPixelColor(strip3.length() - 1 - np, value)
        strip4.setPixelColor(strip4.length() - 1 - np, value)
        np += 1
        pause(50)
    }
})


V2man
 
Posts: 704
Joined: Mon Dec 03, 2018 12:38 am

Re: Maker Makecode and CPX/CPB

by V2man on Fri Feb 21, 2020 2:28 pm

In Makecode you have to press the reset button once and in Maker Makecode you have to press the reset button twice to get the CPLAYBOOT or CPLAYBTBOOT drive.

V2man
 
Posts: 704
Joined: Mon Dec 03, 2018 12:38 am

Re: Maker Makecode and CPX/CPB

by V2man on Fri Feb 21, 2020 5:03 pm

This works on CPB. Adds a rotation of the CPB onboard neopixels.
Code: Select all | TOGGLE FULL SIZE
function SCOLOR () {
    for (let index = 0; index <= strip1.length() - 1; index++) {
        Scolor[index] = light.hsv(index * 22, 255, 255)
    }
    pause(1000)
}
let np = 0
let Scolor: number[] = []
let strip1: light.NeoPixelStrip = null
let strip = light.createStrip(pins.A1, 24)
strip1 = strip.range(0, 12)
let strip2 = strip.range(12, 12)
light.onboardStrip().setBrightness(20)
strip.setBrightness(20)
SCOLOR()
forever(function () {
    np = 0
    Scolor.reverse()
    light.onboardStrip().setAll(0x000000)
    for (let value of Scolor) {
        strip.setAll(0x000000)
        light.onboardStrip().setPixelColor(np, value)
        strip1.setPixelColor(np, value)
        strip2.setPixelColor(strip2.length() - 1 - np, value)
        np += 1
        pause(100)
    }
})

V2man
 
Posts: 704
Joined: Mon Dec 03, 2018 12:38 am

Please be positive and constructive with your questions and comments.