[마이크로비트] 로터리 엔코더 (마이크로 비트 센서 활용)

마이크 비트 로터리 엔코더 동작 예제


마이크 비트 사용한 센서 

6ede8d5c08cdb0f90e55915f137b3809.jpg

마이크 비트 회로도 

fd872a4181e9e24d8b8a61c61440daa8.jpg

마이크 비트 블록 코드

598c485b0e950c24a5e0c59c0e95597f.png


마이크 비트 자바 스크립트 코드

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

control.onEvent(EventBusSource.MICROBIT_ID_IO_P12,EventBusValue.MICROBIT_PIN_EVT_RISE,function(){
  if(pins.digitalReadPin(DigitalPin.P16)==0){
    Cnt+=1
  } else{
    Cnt+=-1
  }
})
control.onEvent(EventBusSource.MICROBIT_ID_IO_P8,EventBusValue.MICROBIT_PIN_EVT_RISE,function(){
  Cnt=0
})
let Cnt=0
Cnt=0
pins.setPull(DigitalPin.P8,PinPullMode.PullUp)
pins.setPull(DigitalPin.P12,PinPullMode.PullUp)
pins.setPull(DigitalPin.P16,PinPullMode.PullUp)
pins.setEvents(DigitalPin.P8,PinEventType.Edge)
pins.setEvents(DigitalPin.P12,PinEventType.Edge)
basic.forever(function(){
  basic.showNumber(Cnt)
  basic.pause(100)
})
0
0
이 글을 페이스북으로 퍼가기 이 글을 트위터로 퍼가기 이 글을 카카오스토리로 퍼가기 이 글을 밴드로 퍼가기

임베디드 보드

번호 제목 글쓴이 날짜 조회수
98 마이크로비트 RGB LED 모듈 ( 센서 활용) icon HellMaker 08-22 13,819
97 마이크로비트 써미스터 온도 센서 (센서 활용) icon HellMaker 08-22 13,517
96 마이크로비트 수은 기울기 센서 (센서 활용) icon HellMaker 08-22 12,870
95 마이크로비트 마이크로 비트 기울기 센서 (센서 활용) icon HellMaker 08-22 13,098
94 마이크로비트 가속도 센서 (마이크로비트 기본 예제) icon 양재동메이커 08-22 13,878
93 마이크로비트 가속도 동서남북 (마이크로비트 기본 예제) icon 양재동메이커 08-22 12,739
92 마이크로비트 버튼 응용 예제 (마이크로비트 기본 예제) icon 양재동메이커 08-22 13,704
91 마이크로비트 버튼 예제 (마이크로비트 기본 예제) icon 양재동메이커 08-22 13,138
90 마이크로비트 매직 라이트 컵 모듈 (아두이노 센서 활용) icon HellMaker 08-14 12,215
89 마이크로비트 심박 센서 ( 아두이노 센서 활용) icon HellMaker 08-14 13,159
88 마이크로비트 충격 센서 (아두이노 센서 활용) icon HellMaker 08-08 13,081
87 마이크로비트 레이저 발광 모듈 (아두이노 센서 활용) icon HellMaker 08-08 13,208
86 마이크로비트 7 컬러 LED 모듈 (아두이노 센서 활용) icon HellMaker 08-08 12,676
85 마이크로비트 CDS 조도 센서 (아두이노 센서 활용) icon HellMaker 08-08 11,988
84 마이크로비트 매직라이트 컵 모듈 활용하기 (아두이노 센서 활용) icon HellMaker 08-08 13,728
83 마이크로비트 기울기 센서 활용 (아두이노 센서 활용) icon HellMaker 08-08 13,784
82 마이크로비트 노크 센서 활용 (아두이노 센서 활용) icon HellMaker 08-08 12,100
81 마이크로비트 수은 기울기 센서 활용 (아두이노 센서 활용) icon HellMaker 08-08 13,605
80 마이크로비트 써미스터 온도 센서 활용 (아두이노 센서 활용) icon HellMaker 08-08 12,339
79 마이크로비트 디지털 홀 센서 활용 (아두이노 센서 활용) icon HellMaker 08-08 14,038