一応完成した。
やっぱり心配したとおりPinケーブルの接触がイマイチ安定しない。
怪しいところは全部テープで固定している。
最終的には100均で時計を買ってきてハンダ結合で閉じ込めるが吉
風車はイマイチな感じ。
2024/12/16~
132個のLEDをDelay無しで普通に132回Shiftさせると617ms(Aが押されたらの内部で)1個あたり4.666msの計算
習作1 レインボーパターン12本が外に向けて色を放射する
こちら習作2 3色の羽根が回転し徐々に速く回ります
こちら習作3 無線で受講生が指定した羽根を任意色で光らせる
こちら
【気付き】
腹立つ。またEdgeにキャッシュ全部を消された。
作りかけのプロジェクトはこれで完全消滅。今年3回目
開発はクロームに乗り換える。
サイトにも重要警告として赤文字で掲載する。
https://makecode.microbit.org/_bwUPjFF583iu
習作4 レインボー12色の花(中心暗→外明るい)
こちらhttps://makecode.microbit.org/_Y5w9pdLWA37Y
習作5 12角ごとに違った12色のグラデバーが開き、回転(A/Bボタンで回転速度変更)
こちら
【気付き】
・使っているブロックライブラリは、同じ1本のテープを複数種類の変数名で再定義(redefines)出来るのはありがたい機能だ。
・回転させるプログラムは今のところ受けが良くない。
放射線の密度が薄いせいかも。36本ぐらいになればそれなりになるかもだが、それも多すぎ。
・リズムに乗った発光を取り入れたらどうかな。
見れば音無しでも乗りやすい太鼓とかそういう奴
・扇状に開いていくパターンもやってみよ
・コード作成効率化のためTyoeScriptベースで記述することがあるが、作ったFunctionがブロックへ反映させず、アクセスできなくなる・消えなくなるなどのバグってがあるのにはホント困る。
/**
* 2024/12/16
*
* Wind Mill System WMS 習作1
*
* リセットで12本のRainBowぼ描画で待ちになる
*
* A押下で、放射状に外に向けローテイトする
*
* B押下で、放射状に外に向けシフトアウトし全部出ていったら、再度繰り返す
*
* AB押下でリスタート
*/
input.onButtonPressed(Button.A, function () {
strip.clear()
ShowRainbow_circle()
while (true) {
Rotate()
}
})
function SetSubRange () {
range00 = strip.range(0, 11)
range01 = strip.range(11, 11)
range02 = strip.range(22, 11)
range03 = strip.range(33, 11)
range04 = strip.range(44, 11)
range05 = strip.range(55, 11)
range06 = strip.range(66, 11)
range07 = strip.range(77, 11)
range08 = strip.range(88, 11)
range09 = strip.range(99, 11)
range10 = strip.range(110, 11)
range11 = strip.range(121, 11)
}
function ShifOut12 () {
range00.shift(1)
range01.shift(1)
range02.shift(1)
range03.shift(1)
range04.shift(1)
range05.shift(1)
range06.shift(1)
range07.shift(1)
range08.shift(1)
range09.shift(1)
range10.shift(1)
range11.shift(1)
strip.show()
}
function shiftOut () {
ShifOut12()
basic.pause(100)
}
input.onButtonPressed(Button.AB, function () {
control.reset()
})
function ShowRainbow_circle () {
startColor = 1
EndColor = 359
range00.showRainbow(startColor, EndColor)
range01.showRainbow(startColor, EndColor)
range02.showRainbow(startColor, EndColor)
range03.showRainbow(startColor, EndColor)
range04.showRainbow(startColor, EndColor)
range05.showRainbow(startColor, EndColor)
range06.showRainbow(startColor, EndColor)
range07.showRainbow(startColor, EndColor)
range08.showRainbow(startColor, EndColor)
range09.showRainbow(startColor, EndColor)
range10.showRainbow(startColor, EndColor)
range11.showRainbow(startColor, EndColor)
}
input.onButtonPressed(Button.B, function () {
strip.clear()
ShowRainbow_circle()
while (true) {
for (let index = 0; index
shiftOut()
}
ShowRainbow_circle()
}
})
function rotate12 () {
range00.rotate(1)
range01.rotate(1)
range02.rotate(1)
range03.rotate(1)
range04.rotate(1)
range05.rotate(1)
range06.rotate(1)
range07.rotate(1)
range08.rotate(1)
range09.rotate(1)
range10.rotate(1)
range11.rotate(1)
strip.show()
}
function Rotate () {
rotate12()
basic.pause(100)
}
let EndColor = 0
let startColor = 0
let range11: neopixel.Strip = null
let range10: neopixel.Strip = null
let range09: neopixel.Strip = null
let range08: neopixel.Strip = null
let range07: neopixel.Strip = null
let range06: neopixel.Strip = null
let range05: neopixel.Strip = null
let range04: neopixel.Strip = null
let range03: neopixel.Strip = null
let range02: neopixel.Strip = null
let range01: neopixel.Strip = null
let range00: neopixel.Strip = null
let strip: neopixel.Strip = null
strip = neopixel.create(DigitalPin.P2, 132, NeoPixelMode.RGB)
strip.setBrightness(32)
SetSubRange()
ShowRainbow_circle()