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

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


마이크 비트 사용한 센서 

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
이 글을 페이스북으로 퍼가기 이 글을 트위터로 퍼가기 이 글을 카카오스토리로 퍼가기 이 글을 밴드로 퍼가기

임베디드 보드

번호 제목 글쓴이 날짜 조회수
14 마이크로비트 7 컬러 LED 모듈 (아두이노 센서 활용) icon HellMaker 08-08 17,628
13 마이크로비트 CDS 조도 센서 (아두이노 센서 활용) icon HellMaker 08-08 18,140
12 마이크로비트 매직라이트 컵 모듈 활용하기 (아두이노 센서 활용) icon HellMaker 08-08 25,656
11 마이크로비트 기울기 센서 활용 (아두이노 센서 활용) icon HellMaker 08-08 18,828
10 마이크로비트 노크 센서 활용 (아두이노 센서 활용) icon HellMaker 08-08 18,669
9 마이크로비트 수은 기울기 센서 활용 (아두이노 센서 활용) icon HellMaker 08-08 18,851
8 마이크로비트 써미스터 온도 센서 활용 (아두이노 센서 활용) icon HellMaker 08-08 18,829
7 마이크로비트 디지털 홀 센서 활용 (아두이노 센서 활용) icon HellMaker 08-08 21,553
6 마이크로비트 아날로그 홀 센서 활용 (아두이노 센서 활용) icon HellMaker 08-08 19,510
5 마이크로비트 마이크로비트로 가위바위보 게임 일산메이커 08-01 18,797
4 마이크로비트 마이크로 비트로 led 문자 출력하기 2 #microbit #마이크로비트 #led Wavy 07-31 18,419
3 마이크로비트 마이크로비트 - led로 문자출력하기 #마이크로비트 #led #문자 #microbit +1 Wavy 07-30 18,059
2 마이크로비트 마이크로 비트로 간단하게 led켜기 (microbit easy led) #microbit #LED #led Wavy 07-24 18,587
1 마이크로비트 마이크로비트 교육자료 - 반응속도 게임 +1 일산메이커 07-19 20,258