# display

### 모든 디스플레이 제어 명령을 차례대로 실행 <a href="#heading" id="heading"></a>

```python
from time import sleep

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


if __name__ == '__main__':

    drone = Drone()
    drone.open()

    delay = 0.5
    
    drone.sendDisplayClearAll(DisplayPixel.Black)
    sleep(delay)

    drone.sendDisplayClear(59, 27, 10, 10, DisplayPixel.White)
    sleep(delay)

    drone.sendDisplayInvert(54, 22, 20, 20)
    sleep(delay)

    drone.sendDisplayDrawPoint(64, 32, DisplayPixel.White)
    sleep(delay)

    drone.sendDisplayDrawLine(10, 10, 118, 54, DisplayPixel.White, DisplayLine.Dotted)
    sleep(delay)

    drone.sendDisplayDrawRect(44, 12, 40, 40, DisplayPixel.White, False, DisplayLine.Dashed)
    sleep(delay)

    drone.sendDisplayDrawCircle(64, 32, 20, DisplayPixel.White, True)
    sleep(delay)
    
    drone.sendDisplayDrawString(10, 10, "HELLO", DisplayFont.LiberationMono5x8, DisplayPixel.White)
    sleep(delay)
    
    drone.sendDisplayDrawStringAlign(0, 128, 30, "E-DRONE", DisplayAlign.Center, DisplayFont.LiberationMono10x16, DisplayPixel.White)
    sleep(delay)
    
    drone.close()
```

### 무작위 위치와 크기의 Clear를 100회 전송 (sendDisplayClear 함수 사용) <a href="#heading-clear-100-senddisplayclear" id="heading-clear-100-senddisplayclear"></a>

```python
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, 100, 1):

        width      = int(random.randint(0, 127))
        height     = int(random.randint(0, 63))
        x          = int(random.randint(0, 127) - width / 2)
        y          = int(random.randint(0, 63) - height / 2)
        pixel      = DisplayPixel(int(random.randint(0, 1)))

        dataArray = drone.sendDisplayClear(x, y, width, height, pixel)
        print("{0} / {1}".format(i, convertByteArrayToString(dataArray)))

        sleep(0.03)
    
    drone.close()
```

### 무작위 위치와 크기의 Clear를 100회 전송 (클래스 데이터 채워서 전송) <a href="#heading-clear-100" id="heading-clear-100"></a>

```python
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.DisplayClear
    header.length   = DisplayClear.getSize()
    header.from_    = DeviceType.Tester
    header.to_      = DeviceType.Controller

    data = DisplayClear()

    for i in range(0, 100, 1):

        data.width      = int(random.randint(0, 127))
        data.height     = int(random.randint(0, 63))
        data.x          = int(random.randint(0, 127) - data.width / 2)
        data.y          = int(random.randint(0, 63) - data.height / 2)
        data.pixel      = DisplayPixel(int(random.randint(0, 1)))

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

        sleep(0.03)
    
    drone.close()
```

### 무작위 위치와 길이의 선을 100번 그리기 (sendDisplayDrawLine 함수 사용) <a href="#heading-100-senddisplaydrawline" id="heading-100-senddisplaydrawline"></a>

```python
import random
from time import sleep

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


if __name__ == '__main__':

    drone = Drone()
    drone.open()
    
    drone.sendDisplayClearAll(DisplayPixel(int(random.randint(0, 1))))
    sleep(0.1)

    for i in range(0, 100, 1):

        x1          = int(random.randint(0, 127))
        y1          = int(random.randint(0, 63))
        x2          = int(random.randint(0, 127))
        y2          = int(random.randint(0, 63))
        pixel       = DisplayPixel(int(random.randint(0, 1)))
        line        = DisplayLine(int(random.randint(0, 2)))

        dataArray = drone.sendDisplayDrawLine(x1, y1, x2, y2, pixel, line)
        print("{0} / {1}".format(i, convertByteArrayToString(dataArray)))

        sleep(0.02)
    
    drone.close()
```

### 무작위 위치와 크기의 원을 100번 출력하기 (sendDisplayDrawCircle 함수 사용) <a href="#heading-100-senddisplaydrawcircle" id="heading-100-senddisplaydrawcircle"></a>

```python
import random
from time import sleep

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


if __name__ == '__main__':

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

    for i in range(0, 100, 1):

        x          = int(random.randint(0, 127))
        y          = int(random.randint(0, 63))
        radius     = int(random.randint(0, 63))
        pixel      = DisplayPixel(int(random.randint(0, 1)))
        flagFill   = bool(random.randint(0, 1))

        drone.sendDisplayDrawCircle(x, y, radius, pixel, flagFill)
        sleep(0.05)

    drone.close()
```

### 무작위 위치와 크기의 원을 100번 출력하기 (클래스 데이터 채워서 전송) <a href="#heading-100" id="heading-100"></a>

```python
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.DisplayDrawCircle
    header.length   = DisplayDrawCircle.getSize()
    header.from_    = DeviceType.Tester
    header.to_      = DeviceType.Controller

    data = DisplayDrawCircle()

    for i in range(0, 100, 1):

        data.x          = int(random.randint(0, 127))
        data.y          = int(random.randint(0, 63))
        data.radius     = int(random.randint(0, 63))
        data.pixel      = DisplayPixel(int(random.randint(0, 1)))
        data.flagFill   = bool(random.randint(0, 1))

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

        sleep(0.03)
    
    drone.close()

```

### 무작위 위치와 크기의 사각형을 100번 출력하기 (sendDisplayDrawRect 함수 사용) <a href="#heading-100-senddisplaydrawrect" id="heading-100-senddisplaydrawrect"></a>

```python
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, 100, 1):

        width      = int(random.randint(0, 127))
        height     = int(random.randint(0, 63))
        x          = int(random.randint(0, 127) - width / 2)
        y          = int(random.randint(0, 63) - height / 2)
        pixel      = DisplayPixel(int(random.randint(0, 1)))
        flagFill   = bool(random.randint(0, 1))
        line       = DisplayLine(int(random.randint(0, 2)))

        dataArray = drone.sendDisplayDrawRect(x, y, width, height, pixel, flagFill, line)
        print("{0} / {1}".format(i, convertByteArrayToString(dataArray)))

        sleep(0.03)
    
    drone.close()
```

### 무작위 위치와 크기의 사각형을 100번 출력하기 (클래스 데이터 채워서 전송) <a href="#heading-100" id="heading-100"></a>

```python
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.DisplayDrawRect
    header.length   = DisplayDrawRect.getSize()
    header.from_    = DeviceType.Tester
    header.to_      = DeviceType.Controller

    data = DisplayDrawRect()

    for i in range(0, 100, 1):

        data.width      = int(random.randint(0, 127))
        data.height     = int(random.randint(0, 63))
        data.x          = int(random.randint(0, 127) - data.width / 2)
        data.y          = int(random.randint(0, 63) - data.height / 2)
        data.pixel      = DisplayPixel(int(random.randint(0, 1)))
        data.flagFill   = bool(random.randint(0, 1))
        data.line       = DisplayLine(int(random.randint(0, 2)))

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

        sleep(0.03)
    
    drone.close()
```

### 'HELLO' 문자열을 무작위 위치에 100번 출력하기 <a href="#heading-hello-100" id="heading-hello-100"></a>

```python
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.DisplayDrawString
    header.length   = DisplayDrawString.getSize()
    header.from_    = DeviceType.Tester
    header.to_      = DeviceType.Controller

    data = DisplayDrawString()

    for i in range(0, 100, 1):

        data.x          = int(random.randint(0, 127))
        data.y          = int(random.randint(0, 63))
        data.font       = DisplayFont(int(random.randint(0, 1)))
        data.pixel      = DisplayPixel(int(random.randint(0, 1)))
        data.message    = "HELLO"
        
        header.length   = DisplayDrawString.getSize() + len(data.message)

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

        sleep(0.03)
    
    drone.close()
```

### 'LOVE' 문자열을 왼쪽, 중앙, 오른쪽 정렬을 사용하여 무작위 위치에 10번 출력하기 <a href="#heading-love-10" id="heading-love-10"></a>

```python
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.DisplayDrawStringAlign
    header.length   = DisplayDrawStringAlign.getSize()
    header.from_    = DeviceType.Tester
    header.to_      = DeviceType.Controller

    data = DisplayDrawStringAlign()

    for i in range(0, 10, 1):

        data.x_start    = 0
        data.x_end      = 127
        data.y          = int(random.randint(0, 63))
        data.align      = DisplayAlign(int(random.randint(0, 2)))
        data.font       = DisplayFont(int(random.randint(0, 1)))
        data.pixel      = DisplayPixel(int(random.randint(0, 1)))
        data.message    = "LOVE"

        header.length   = DisplayDrawStringAlign.getSize() + len(data.message)

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

        sleep(0.03)

    drone.close()
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://robolink.gitbook.io/codrone-mini/codrone_lib/codrone_python_main/display.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
