2016-04-06 03:21:24 +02:00
|
|
|
let strip = neopixel.create(24);
|
|
|
|
let br = 100;
|
|
|
|
strip.setBrigthness(100);
|
|
|
|
input.onButtonPressed(Button.B, () => {
|
|
|
|
br = br + 20;
|
|
|
|
if (br > 255) {
|
|
|
|
br = 5;
|
2016-04-04 02:38:50 +02:00
|
|
|
}
|
2016-04-06 03:21:24 +02:00
|
|
|
strip.setBrigthness(br);
|
2016-04-04 02:38:50 +02:00
|
|
|
});
|
|
|
|
|
2016-04-06 03:21:24 +02:00
|
|
|
let rotationMode = false;
|
|
|
|
input.onButtonPressed(Button.A, () => {
|
|
|
|
rotationMode = !rotationMode;
|
|
|
|
if (rotationMode) {
|
|
|
|
basic.showLeds(`
|
|
|
|
. # # # .
|
|
|
|
# . . . #
|
|
|
|
# . . . #
|
|
|
|
# . . . #
|
|
|
|
. # # # .
|
|
|
|
`);
|
|
|
|
} else {
|
|
|
|
basic.showLeds(`
|
|
|
|
. . # . .
|
|
|
|
. . . # .
|
|
|
|
# # # # #
|
|
|
|
. . . # .
|
|
|
|
. . # . .
|
|
|
|
`);
|
|
|
|
|
2016-04-04 02:38:50 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-04-06 03:21:24 +02:00
|
|
|
while (true) {
|
|
|
|
let x = input.acceleration(Dimension.X) / 2
|
|
|
|
let y = input.acceleration(Dimension.Y) / 2
|
|
|
|
let z = input.acceleration(Dimension.Z) / 2
|
|
|
|
if (rotationMode) {
|
|
|
|
strip.rotate();
|
|
|
|
} else {
|
|
|
|
strip.setPix(0, x, y, -z);
|
|
|
|
strip.shift(1);
|
2016-04-04 02:38:50 +02:00
|
|
|
}
|
2016-04-06 03:21:24 +02:00
|
|
|
strip.display();
|
|
|
|
basic.pause(100);
|
|
|
|
}
|