light

sendLightManual() ν•¨μˆ˜λ₯Ό μ‚¬μš©ν•˜μ—¬ μ‘°μ’…κΈ° LED μ œμ–΄ν•˜κΈ°

import random
from time import sleep

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


if __name__ == '__main__':

    drone = Drone()
    drone.open()


    drone.sendLightManual(DeviceType.Controller, 0xFF, 0)
    sleep(1);
    
    
    drone.sendLightManual(DeviceType.Controller, LightFlagsController.BodyRed.value, 10)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Controller, LightFlagsController.BodyRed.value, 100)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Controller, LightFlagsController.BodyRed.value, 0)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Controller, LightFlagsController.BodyGreen.value, 10)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Controller, LightFlagsController.BodyGreen.value, 100)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Controller, LightFlagsController.BodyGreen.value, 0)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Controller, LightFlagsController.BodyBlue.value, 10)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Controller, LightFlagsController.BodyBlue.value, 100)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Controller, LightFlagsController.BodyBlue.value, 0)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Controller, 0b00000011, 10)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Controller, 0b00000011, 100)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Controller, 0b00000011, 0)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Controller, 0b00000110, 10)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Controller, 0b00000110, 100)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Controller, 0b00000110, 0)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Controller, 0b00000101, 10)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Controller, 0b00000101, 100)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Controller, 0b00000101, 0)
    sleep(1);


    drone.close()

sendLightManual() ν•¨μˆ˜λ₯Ό μ‚¬μš©ν•˜μ—¬ λ“œλ‘  LED μ œμ–΄ν•˜κΈ°

from time import sleep

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


if __name__ == '__main__':

    drone = Drone()
    drone.open()


    drone.sendLightManual(DeviceType.Drone, 0xFF, 0)
    sleep(1);


    drone.sendLightManual(DeviceType.Drone, LightFlagsDrone.BodyRed.value, 10)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Drone, LightFlagsDrone.BodyRed.value, 100)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Drone, LightFlagsDrone.BodyRed.value, 0)
    sleep(1);

    drone.sendLightManual(DeviceType.Drone, LightFlagsDrone.BodyGreen.value, 10)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Drone, LightFlagsDrone.BodyGreen.value, 100)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Drone, LightFlagsDrone.BodyGreen.value, 0)
    sleep(1);

    drone.sendLightManual(DeviceType.Drone, LightFlagsDrone.BodyBlue.value, 10)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Drone, LightFlagsDrone.BodyBlue.value, 100)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Drone, LightFlagsDrone.BodyBlue.value, 0)
    sleep(1);


    drone.sendLightManual(DeviceType.Drone, 0x06, 10)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Drone, 0x06, 100)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Drone, 0x06, 0)
    sleep(1);

    drone.sendLightManual(DeviceType.Drone, 0x0A, 10)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Drone, 0x0A, 100)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Drone, 0x0A, 0)
    sleep(1);

    drone.sendLightManual(DeviceType.Drone, 0x0C, 10)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Drone, 0x0C, 100)
    sleep(1);
    
    drone.sendLightManual(DeviceType.Drone, 0x0C, 0)
    sleep(1);


    drone.close()

sendLightMode, sendLightEvent ν•¨μˆ˜λ₯Ό μ‚¬μš©ν•˜μ—¬ μ‘°μ’…κΈ° LED μ œμ–΄ν•˜κΈ°

from time import sleep

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


if __name__ == '__main__':

    drone = Drone()
    drone.open()


    print("BodyHold")
    drone.sendLightModeColor(LightModeController.BodyHold, 200, 200, 200, 0)
    sleep(2); 
    

    #sendLightModeColor
    print("BodyDimming 1")
    drone.sendLightModeColor(LightModeController.BodyDimming, 3, 200, 0, 200)
    sleep(3);
    
    #sendLightModeColors
    print("BodyDimming 2")
    drone.sendLightModeColors(LightModeController.BodyDimming, 3, Colors.Cyan)
    sleep(3);
    

    # sendLightEventColor*
    print("BodyDimming 3")
    drone.sendLightEventColor(LightModeController.BodyDimming, 3, 3, 200, 200, 200)
    sleep(3);
    
    # sendLightEventColors*
    print("BodyDimming 4")
    drone.sendLightEventColors(LightModeController.BodyDimming, 3, 3, Colors.Magenta)
    sleep(3);
    

    drone.close()

sendLightMode, sendLightEvent ν•¨μˆ˜λ₯Ό μ‚¬μš©ν•˜μ—¬ λ“œλ‘  LED μ œμ–΄ν•˜κΈ°

from time import sleep

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


if __name__ == '__main__':

    drone = Drone()
    drone.open()


    drone.sendLightModeColor(LightModeDrone.BodyHold, 200, 0, 200, 200)
    sleep(1);


    # sendLightModeColor*
    drone.sendLightModeColor(LightModeDrone.BodyDimming, 3, 0, 0, 200)
    sleep(3);
    
    # sendLightModeColors*
    drone.sendLightModeColors(LightModeDrone.BodyDimming, 3, Colors.Cyan)
    sleep(3);
    

    # sendLightEventColor*
    drone.sendLightEventColor(LightModeDrone.BodyDimming, 3, 5, 200, 200, 200)
    sleep(3);
    
    # sendLightEventColors*
    drone.sendLightEventColors(LightModeDrone.BodyDimming, 3, 3, Colors.Magenta)
    sleep(3);
    

    drone.close()

μ‘°μ’…κΈ°μ˜ LEDλ₯Ό λžœλ€ν•œ μƒ‰μœΌλ‘œ 점점 λ°μ•„μ‘Œλ‹€ μ–΄λ‘μ›Œμ§€κ²Œ ν•˜λŠ” λͺ…령을 10회 μ‹€ν–‰

  • LightModeColor / sendLightModeColor ν•¨μˆ˜ μ‚¬μš©

import random
from time import sleep

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


if __name__ == '__main__':

    drone = Drone()
    drone.open()

    for i in range(0, 10, 1):
        
        r    = int(random.randint(0, 255))
        g    = int(random.randint(0, 255))
        b    = int(random.randint(0, 255))

        dataArray = drone.sendLightModeColor(LightModeController.BodyDimming, 1, r, g, b)
        print("{0} / {1}".format(i, convertByteArrayToString(dataArray)))

        sleep(0.6)
    
    drone.close()

μ‘°μ’…κΈ°μ˜ LEDλ₯Ό λžœλ€ν•œ μƒ‰μœΌλ‘œ 점점 λ°μ•„μ‘Œλ‹€ μ–΄λ‘μ›Œμ§€κ²Œ ν•˜λŠ” λͺ…령을 10회 μ‹€ν–‰

  • LightModeColor / 클래슀 데이터λ₯Ό μ±„μ›Œμ„œ 전솑

import random
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.LightMode
    header.length   = LightModeColor.getSize()
    header.from_    = DeviceType.Tester
    header.to_      = DeviceType.Controller

    data = LightModeColor()

    data.mode.mode      = LightModeController.BodyDimming.value
    data.mode.interval  = 1

    for i in range(0, 10, 1):
        
        data.color.r    = int(random.randint(0, 255))
        data.color.g    = int(random.randint(0, 255))
        data.color.b    = int(random.randint(0, 255))

        dataArray = drone.transfer(header, data)
        print("{0} / {1}".format(i, convertByteArrayToString(dataArray)))

        sleep(0.6)
    
    drone.close()

μ‘°μ’…κΈ°μ˜ LEDλ₯Ό λžœλ€ν•œ μƒ‰μœΌλ‘œ 점점 λ°μ•„μ‘Œλ‹€ μ–΄λ‘μ›Œμ§€κ²Œ ν•˜λŠ” λͺ…령을 10회 μ‹€ν–‰

  • LightModeColors / sendLightModeColors ν•¨μˆ˜ μ‚¬μš©

import random
from time import sleep

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


if __name__ == '__main__':

    drone = Drone()
    drone.open()

    for i in range(0, 10, 1):
        
        colors = Colors(random.randint(0, Colors.EndOfType.value))

        dataArray = drone.sendLightModeColors(LightModeController.BodyDimming, 1, colors)
        print("{0} / {1}".format(i, convertByteArrayToString(dataArray)))

        sleep(0.6)
    
    drone.close()

μ‘°μ’…κΈ°μ˜ LEDλ₯Ό λžœλ€ν•œ μƒ‰μœΌλ‘œ 점점 λ°μ•„μ‘Œλ‹€ μ–΄λ‘μ›Œμ§€κ²Œ ν•˜λŠ” λͺ…령을 10회 μ‹€ν–‰

  • LightModeColors / 클래슀 데이터λ₯Ό μ±„μ›Œμ„œ 전솑

import random
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.LightMode
    header.length   = LightModeColors.getSize()
    header.from_    = DeviceType.Tester
    header.to_      = DeviceType.Controller

    data = LightModeColors()

    data.mode.mode      = LightModeController.BodyDimming.value
    data.mode.interval  = 1

    for i in range(0, 10, 1):
        
        data.colors    = Colors(random.randint(0, Colors.EndOfType.value))

        dataArray = drone.transfer(header, data)
        print("{0} / {1}".format(i, convertByteArrayToString(dataArray)))

        sleep(0.6)
    
    drone.close()

λ“œλ‘ μ˜ LEDλ₯Ό λžœλ€ν•œ μƒ‰μœΌλ‘œ 점점 λ°μ•„μ‘Œλ‹€ μ–΄λ‘μ›Œμ§€κ²Œ ν•˜λŠ” λͺ…령을 10회 μ‹€ν–‰

  • LightModeColors / sendLightDefaultColor ν•¨μˆ˜ μ‚¬μš©

import random
from time import sleep

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


if __name__ == '__main__':

    drone = Drone(True, True, True, True, True)
    drone.open()

    for i in range(0, 10, 1):
        
        r    = int(random.randint(0, 255))
        g    = int(random.randint(0, 255))
        b    = int(random.randint(0, 255))

        dataArray = drone.sendLightDefaultColor(LightModeDrone.BodyDimming, 1, r, g, b)
        print("{0} / {1}".format(i, convertByteArrayToString(dataArray)))

        sleep(2)
    
    drone.close()

Last updated