テープLEDのプログラム 改良により色、光り方などに変化の可能性有り

Dependencies:   mbed SBDBT arrc_mbed

Committer:
sopuranoaruto
Date:
Sun Jan 30 12:27:02 2022 +0000
Revision:
0:12a2f5f9ab60
tapeLED

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sopuranoaruto 0:12a2f5f9ab60 1 #include "neopixel.h"
sopuranoaruto 0:12a2f5f9ab60 2 #include "sbdbt.hpp"
sopuranoaruto 0:12a2f5f9ab60 3
sopuranoaruto 0:12a2f5f9ab60 4 NeoPixelOut npx(D12,1);
sopuranoaruto 0:12a2f5f9ab60 5 sbdbt sb(A0,A1);
sopuranoaruto 0:12a2f5f9ab60 6 bool mode = 0;
sopuranoaruto 0:12a2f5f9ab60 7
sopuranoaruto 0:12a2f5f9ab60 8 int main(){
sopuranoaruto 0:12a2f5f9ab60 9 npx.global_scale = 0.5f;
sopuranoaruto 0:12a2f5f9ab60 10 npx.normalize = false;
sopuranoaruto 0:12a2f5f9ab60 11 while(1){
sopuranoaruto 0:12a2f5f9ab60 12 if(sb.select() == 1){
sopuranoaruto 0:12a2f5f9ab60 13 if(mode == 0){
sopuranoaruto 0:12a2f5f9ab60 14 mode = 1;
sopuranoaruto 0:12a2f5f9ab60 15 }else if(mode == 1){
sopuranoaruto 0:12a2f5f9ab60 16 mode = 0;
sopuranoaruto 0:12a2f5f9ab60 17 }
sopuranoaruto 0:12a2f5f9ab60 18 }
sopuranoaruto 0:12a2f5f9ab60 19 if(mode == 0){
sopuranoaruto 0:12a2f5f9ab60 20 npx.setPixelColor(0,0xff0000);
sopuranoaruto 0:12a2f5f9ab60 21 npx.show();
sopuranoaruto 0:12a2f5f9ab60 22 }else if(mode == 1){
sopuranoaruto 0:12a2f5f9ab60 23 npx.setPixelColor(0,0x0000ff);
sopuranoaruto 0:12a2f5f9ab60 24 npx.show();
sopuranoaruto 0:12a2f5f9ab60 25 }
sopuranoaruto 0:12a2f5f9ab60 26 }
sopuranoaruto 0:12a2f5f9ab60 27 }