pyflipdot API

HanoverController

The HanoverController is the main class used for controlling flipdot signs.

class pyflipdot.pyflipdot.HanoverController(port: serial.serialposix.Serial)[source]

Bases: object

A controller for addressing Hanover signs

add_sign(name: str, sign: pyflipdot.sign.HanoverSign)[source]

Adds a sign for the controller to communicate with

Parameters

sign (HanoverSign) – Sign to add

Raises

ValueError – Sign with same name already added

draw_image(image_data: numpy.array, sign_name: str = None)[source]

Sends an image to a sign to be displayed

Parameters
  • image_data (np.array) – Image to display

  • sign_name (str, optional) – Sign to address

Raises

ValueError – Ambiguity which sign is to be addressed

property signs

Get the connected signs

Returns

Signs, indexed by name

Return type

Dict[str, HanoverSign]

start_test_signs()[source]

Broadcasts the test signs start command All signs connected to the serial port will loop the test sequence. Note: The sign need not be added to the controller for this sequence to take effect.

stop_test_signs()[source]

Broadcasts the test signs stop command All signs connected to the serial port will stop the test sequence. Note: The sign need not be added to the controller for this sequence to take effect.

HanoverSign

The HanoverSign class defines the specific signs connected to your controller, allowing them to be individually addressed.

class pyflipdot.sign.HanoverSign(address: int, width: int, height: int, flip: bool = False)[source]

Bases: object

A Hanover sign

address

Address of the sign

Type

int

flip

True if the sign is upside-down

Type

bool

height

Pixel height of the sign

Type

int

width

Pixel width of the sidn

Type

int

create_image() → numpy.ndarray[source]

Creates a blank image

Returns

The blank image

Return type

np.ndarray

to_image_packet(image_data: numpy.array) → pyflipdot.data.ImagePacket[source]

Produces a serial packet from an image

Parameters

image_data (np.array) – Image data

Returns

packet

Return type

ImagePacket

Raises

ValueError – Image incompatible with the sign