최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday

티스토리 뷰

Microbit/Maqueen 로봇

모터 콘트롤

serpiko 2020. 6. 29. 02:41

Motor control

  • Learning Target: Mastering the basic method of motor control.

  • Effect: The car forward 1 second, right turn 1 second, left turn 1 second, back 1 second, back and right turn 1 second.

image by : https://wiki.dfrobot.com/micro_Maqueen_for_micro_bit_SKU_ROB0148-E

 

 

에디터 > 새프로젝트를 선택하여 에디터 활성화

https://makecode.microbit.org/#editor

 

Microsoft MakeCode for micro:bit

A Blocks / JavaScript code editor for the micro:bit powered by Microsoft MakeCode.

makecode.microbit.org

 

 

 

고급 > 확장에서 Maqueen 을 검색하여 다운로드

 

 

basic.forever(function () {
    maqueen.MotorRun(maqueen.aMotors.M1, maqueen.Dir.CW, 255)
    maqueen.MotorRun(maqueen.aMotors.M2, maqueen.Dir.CW, 255)
    basic.pause(1000)
    maqueen.MotorRun(maqueen.aMotors.M1, maqueen.Dir.CW, 255)
    maqueen.MotorRun(maqueen.aMotors.M2, maqueen.Dir.CW, 0)
    basic.pause(1000)
    maqueen.MotorRun(maqueen.aMotors.M1, maqueen.Dir.CW, 0)
    maqueen.MotorRun(maqueen.aMotors.M2, maqueen.Dir.CW, 255)
    basic.pause(1000)
    maqueen.MotorRun(maqueen.aMotors.M1, maqueen.Dir.CCW, 255)
    maqueen.MotorRun(maqueen.aMotors.M2, maqueen.Dir.CCW, 255)
    basic.pause(1000)
    maqueen.MotorRun(maqueen.aMotors.M1, maqueen.Dir.CCW, 255)
    maqueen.MotorRun(maqueen.aMotors.M2, maqueen.Dir.CCW, 0)
    basic.pause(1000)
})

 

 

'Microbit > Maqueen 로봇' 카테고리의 다른 글

장애물 피하기 (동작영상)  (0) 2020.06.29
댓글