buzzer

sendBuzzer ν•¨μˆ˜ ν…ŒμŠ€νŠΈ

from time import sleep

from e_drone.drone import *
from e_drone.protocol import *


if __name__ == '__main__':

    drone = Drone()
    drone.open()
    

    drone.sendBuzzer(BuzzerMode.Mute, BuzzerScale.Mute.value, 500)
    sleep(1)

    drone.sendBuzzer(BuzzerMode.Scale, BuzzerScale.C4.value, 500)
    sleep(1)

    drone.sendBuzzer(BuzzerMode.Hz, 500, 500)
    sleep(1)


    drone.sendBuzzerMute(100)
    drone.sendBuzzerMuteReserve(100)
    sleep(1.2)


    drone.sendBuzzerScale(BuzzerScale.C5, 500)
    drone.sendBuzzerScaleReserve(BuzzerScale.D5, 500)
    sleep(1.2)


    drone.sendBuzzerHz(1000, 500)
    drone.sendBuzzerHzReserve(1200, 500)
    sleep(1.2)
    

    drone.close()

'학ꡐ 쒅이 λ•‘λ•‘λ•‘' 일뢀 μ—°μ£Ό

from time import sleep

from e_drone.drone import *
from e_drone.protocol import *


if __name__ == '__main__':

    drone = Drone()
    drone.open()
    
    drone.sendBuzzer(BuzzerMode.Mute, BuzzerScale.Mute.value, 100)
    sleep(0.2);
    
    drone.sendBuzzerScale(BuzzerScale.G4, 300);     sleep(0.4);
    drone.sendBuzzerScale(BuzzerScale.G4, 300);     sleep(0.4);
    drone.sendBuzzerScale(BuzzerScale.A4, 300);     sleep(0.4);
    drone.sendBuzzerScale(BuzzerScale.A4, 300);     sleep(0.4);
    drone.sendBuzzerScale(BuzzerScale.G4, 300);     sleep(0.4);
    drone.sendBuzzerScale(BuzzerScale.G4, 300);     sleep(0.4);
    drone.sendBuzzerScale(BuzzerScale.E4, 300);     sleep(0.4);

    drone.close()

Buzzer 클래슀 데이터λ₯Ό 직접 μ±„μ›Œμ„œ μ „μ†‘ν•˜κΈ°

from time import sleep

from e_drone.drone import *
from e_drone.protocol import *


if __name__ == '__main__':

    drone = Drone()
    drone.open()


    header = Header()
    
    header.dataType = DataType.Buzzer
    header.length   = Buzzer.getSize()
    header.from_    = DeviceType.Tester
    header.to_      = DeviceType.Controller


    data = Buzzer()

    data.mode       = BuzzerMode.Scale
    data.value      = BuzzerScale.C5.value
    data.time       = 500

    drone.transfer(header, data)
    sleep(1)


    data.mode       = BuzzerMode.Hz
    data.value      = 1200
    data.time       = 500

    drone.transfer(header, data)
    sleep(1)


    drone.close()

Last updated