modi_plus.module.output_module package

Submodules

modi_plus.module.output_module.display module

Display module.

class modi_plus.module.output_module.display.Display(id_, uuid, connection_task)[source]

Bases: OutputModule

DOT_LEN = 1152
DOT_SPLIT_LEN = 23
HEIGHT = 96
PRESET_PICTURE = {'Airplane': 'res/airplane.bmp', 'Ambulance': 'res/ambul.bmp', 'Amusement park': 'res/amuse.bmp', 'Angel': 'res/angel.bmp', 'Apartment': 'res/apart.bmp', 'Apple': 'res/apple.bmp', 'Banana': 'res/banana.bmp', 'Battery': 'res/battery.bmp', 'Bicycle': 'res/bicycle.bmp', 'Book': 'res/book.bmp', 'Boy': 'res/boy.bmp', 'Building': 'res/build.bmp', 'Bulb': 'res/bulb.bmp', 'Bus': 'res/bus.bmp', 'Butterfly': 'res/butfly.bmp', 'Cake': 'res/cake.bmp', 'Camera': 'res/camera.bmp', 'Candy': 'res/candy.bmp', 'Car': 'res/car.bmp', 'Cat': 'res/cat.bmp', 'Check': 'res/check.bmp', 'Chick': 'res/chick.bmp', 'Chicken': 'res/chicken.bmp', 'Cloud': 'res/cloud.bmp', 'Coin': 'res/coin.bmp', 'Communication ': 'res/comm.bmp', 'Crown': 'res/crown.bmp', 'Devil': 'res/devil.bmp', 'Dice': 'res/dice.bmp', 'Doctor': 'res/doctor.bmp', 'Dog': 'res/dog.bmp', 'Dolphin': 'res/dolphin.bmp', 'Donut': 'res/donut.bmp', 'Download': 'res/download.bmp', 'Dragon': 'res/dragon.bmp', 'Drum': 'res/drum.bmp', 'Earth': 'res/earth.bmp', 'Farmer': 'res/farmer.bmp', 'Field': 'res/field.bmp', 'Fire': 'res/fire.bmp', 'Fish': 'res/fish.bmp', 'Flag': 'res/flag.bmp', 'Flower': 'res/flower.bmp', 'Ghost': 'res/ghost.bmp', 'Gift box': 'res/giftbox.bmp', 'Girl': 'res/girl.bmp', 'Gittar': 'res/gittar.bmp', 'Grandfather': 'res/grandf.bmp', 'Grandmother': 'res/grandm.bmp', 'Halloween Pumpkin': 'res/pumpkin.bmp', 'Hamburger': 'res/hamburg.bmp', 'Heart': 'res/heart.bmp', 'Hedgehog': 'res/hedgeh.bmp', 'Helicopter': 'res/helicop.bmp', 'Hospital': 'res/hospital.bmp', 'Hot-air balloon': 'res/hotair.bmp', 'Key': 'res/key.bmp', 'Left arrow': 'res/lefta.bmp', 'Letter': 'res/letter.bmp', 'Lion': 'res/lion.bmp', 'Ludolf': 'res/ludolf.bmp', 'Mask': 'res/mask.bmp', 'Medal': 'res/medal.bmp', 'Men': 'res/men.bmp', 'Microphone': 'res/microp.bmp', 'Microscope': 'res/micros.bmp', 'Moon': 'res/moon.bmp', 'Mountain': 'res/mountain.bmp', 'Musical note': 'res/note.bmp', 'Nuddle': 'res/nuddle.bmp', 'Paper': 'res/paper.bmp', 'Park': 'res/park.bmp', 'Pause': 'res/pause.bmp', 'Peach': 'res/peach.bmp', 'Penguin': 'res/penguin.bmp', 'Piano': 'res/piano.bmp', 'Pizza': 'res/pizza.bmp', 'Play': 'res/play.bmp', 'Police': 'res/police.bmp', 'Police car': 'res/policec.bmp', 'Power': 'res/power.bmp', 'Programmer': 'res/program.bmp', 'Rabbit': 'res/rabbit.bmp', 'Radio': 'res/radio.bmp', 'Rain': 'res/rain.bmp', 'Retry': 'res/retry.bmp', 'Right arrow': 'res/righta.bmp', 'Rock': 'res/rock.bmp', 'Rocket': 'res/rocket.bmp', 'Santa Claus': 'res/santa.bmp', 'School': 'res/school.bmp', 'Scissors': 'res/scissors.bmp', 'Ship': 'res/ship.bmp', 'Siren': 'res/siren.bmp', 'Snow': 'res/snow.bmp', 'Soccer ball': 'res/soccer.bmp', 'Space': 'res/space.bmp', 'Sparrow': 'res/sparrow.bmp', 'Sports car': 'res/sportsc.bmp', 'Star': 'res/star.bmp', 'Stop': 'res/stop2.bmp', 'Strawberry': 'res/strawb.bmp', 'Sun': 'res/sun.bmp', 'TV': 'res/tv.bmp', 'Teacher': 'res/teacher.bmp', 'Telephone': 'res/tele.bmp', 'Telescope': 'res/teles.bmp', 'Thumbs up': 'res/thumbs.bmp', 'Thunder': 'res/thunder.bmp', 'Train': 'res/train.bmp', 'Tree': 'res/tree.bmp', 'Turtle': 'res/turtle.bmp', 'Wastebasket': 'res/waste.bmp', 'Watch': 'res/watch.bmp', 'Water drop': 'res/water.bmp', 'Watermelon': 'res/waterm.bmp', 'Wind': 'res/wind.bmp', 'Witch': 'res/witch.bmp', 'Women': 'res/women.bmp', 'X': 'res/x.bmp', 'a house of brick': 'res/brick.bmp', 'a house of straw': 'res/straw.bmp', 'angry': 'res/angry.bmp', 'baby': 'res/baby.bmp', 'basketball': 'res/basket.bmp', 'crying': 'res/cry.bmp', 'crystal ball': 'res/ball.bmp', 'dizzy': 'res/dizzy.bmp', 'down arrow': 'res/down.bmp', 'embarrassed': 'res/emv.bmp', 'falling in love': 'res/love.bmp', 'game console': 'res/game.bmp', 'jewerly': 'res/jewerly.bmp', 'log cabin': 'res/cabin.bmp', 'losing ticket': 'res/losing.bmp', 'loud speaker': 'res/speaker.bmp', 'magic hat': 'res/hat.bmp', 'magic wand': 'res/wand.bmp', 'potion': 'res/potion.bmp', 'prize': 'res/prize.bmp', 'proud': 'res/proud.bmp', 'sleeping': 'res/sleeping.bmp', 'smiling': 'res/smiling.bmp', 'smiling brightly': 'res/smileb.bmp', 'stop sign': 'res/stop.bmp', 'straight sign': 'res/straigh.bmp', 'surprised': 'res/surprise.bmp', 'tired': 'res/tired.bmp', 'turn a blind eye': 'res/bilnd.bmp', 'turn left sign': 'res/lefts.bmp', 'turn right sign': 'res/rights.bmp', 'up arrow': 'res/up.bmp', 'vacant lot': 'res/vacant.bmp'}
PROPERTY_DISPLAY_DRAW_DOT = 18
PROPERTY_DISPLAY_DRAW_PICTURE = 19
PROPERTY_DISPLAY_MOVE_SCREEN = 26
PROPERTY_DISPLAY_RESET = 21
PROPERTY_DISPLAY_SET_OFFSET = 25
PROPERTY_DISPLAY_WRITE_TEXT = 17
PROPERTY_DISPLAY_WRITE_VARIABLE = 22
TEXT_SPLIT_LEN = 24
WIDTH = 96
draw_dot(dot: bytes) None[source]

Clears the display and show the input dot on the display.

Parameters:

dot (bytes) – Dot to display

Returns:

None

draw_picture(name: int) None[source]

Clears the display and show the input picture on the display.

Parameters:
  • x (int) – X coordinate of the desired position

  • y (int) – Y coordinate of te desired position

  • name (float) – Picture name to display.

Returns:

None

static preset_pictures() List[str][source]
reset(mode=0) None[source]

Clear the screen.

Parameters:

mode – Erase mode - mode 0 : Erase inside buffer(it looks like nothing has changed) - mode 1 : Erase display

Returns:

None

set_offset(x: int, y: int) None[source]

Set origin point on the screen

Parameters:
  • x (int) – X-axis offset on screen

  • y (int) – Y-axis offset on screen

Returns:

None

property text: str
write_text(text: str) None[source]

Show the input string on the display.

Parameters:

text (str) – Text to display.

Returns:

None

write_variable_line(line: int, variable: float) None[source]

Show the input variable on the display.

Parameters:
  • line (int) – display line number of the desired position

  • variable (float) – Variable to display.

Returns:

None

write_variable_xy(x: int, y: int, variable: float) None[source]

Show the input variable on the display.

Parameters:
  • x (int) – X coordinate of the desired position

  • y (int) – Y coordinate of te desired position

  • variable (float) – Variable to display.

Returns:

None

modi_plus.module.output_module.led module

Led module.

class modi_plus.module.output_module.led.Led(id_, uuid, connection_task)[source]

Bases: OutputModule

PROPERTY_LED_SET_RGB = 16
PROPERTY_LED_STATE = 2
PROPERTY_OFFSET_BLUE = 4
PROPERTY_OFFSET_GREEN = 2
PROPERTY_OFFSET_RED = 0
property blue: int

Returns the current value of the blue component of the LED

Returns:

Blue component

Return type:

int

property green: int

Returns the current value of the green component of the LED

Returns:

Green component

Return type:

int

property red: int

Returns the current value of the red component of the LED

Returns:

Red component

Return type:

int

property rgb: Tuple[int, int, int]
set_rgb(red: int, green: int, blue: int) None[source]

Sets the color of the LED light with given RGB values, and returns the current RGB values.

Parameters:
  • red (int) – Red component to set

  • green (int) – Green component to set

  • blue (int) – Blue component to set

Returns:

None

turn_off() None[source]

Turn off led.

Returns:

None

turn_on() None[source]

Turn on led at maximum brightness.

Returns:

RGB value of the LED set to maximum brightness

Return type:

None

modi_plus.module.output_module.motor module

Motor module.

class modi_plus.module.output_module.motor.Motor(id_, uuid, connection_task)[source]

Bases: OutputModule

PROPERTY_MOTOR_ANGLE = 18
PROPERTY_MOTOR_ANGLE_APPEND = 19
PROPERTY_MOTOR_SPEED = 17
PROPERTY_MOTOR_STATE = 2
PROPERTY_MOTOR_STOP = 20
PROPERTY_OFFSET_CURRENT_ANGLE = 0
PROPERTY_OFFSET_CURRENT_SPEED = 2
PROPERTY_OFFSET_TARGET_ANGLE = 4
PROPERTY_OFFSET_TARGET_SPEED = 6
property angle: int

Returns current angle

Returns:

Current angle value

Return type:

int

append_angle(target_angle: int, target_speed: int = 70) None[source]

append the angle form current angle of the motor

Parameters:
  • target_angle (int) – Angle to append the motor angle.

  • target_speed (int) – Speed to reach target angle.

Returns:

None

set_angle(target_angle: int, target_speed: int = 70) None[source]

Sets the angle of the motor

Parameters:
  • target_angle (int) – Angle to set the motor.

  • target_speed (int) – Speed to reach target angle.

Returns:

None

set_speed(target_speed: int) None[source]

Sets the speed of the motor

Parameters:

target_speed (int) – Speed to set the motor.

Returns:

None

property speed: int

Returns current speed

Returns:

Current speed value

Return type:

int

stop() None[source]

Stop operating motor

Returns:

None

property target_angle: int

Returns target angle

Returns:

Target angle value

Return type:

int

property target_speed: int

Returns target speed

Returns:

Target speed value

Return type:

int

modi_plus.module.output_module.speaker module

Speaker module.

class modi_plus.module.output_module.speaker.Speaker(id_, uuid, connection_task)[source]

Bases: OutputModule

PRESET_MUSIC = {'16 Waltzes': 'res/Brahms16.mid', 'Alarm': 'res/Alarm.wav', 'Bach: Minuet in G': 'res/BachG.mid', 'Beethoven: Minuet in G': 'res/BeethG.mid', 'Blue Danube': 'res/Straus.mid', 'Bomb': 'res/Bomb.wav', 'Bouncing': 'res/bouncing.wav', 'Brahms: Lullaby': 'res/BrahmsL.mid', 'Bridal Chorus': 'res/Wagner.mid', 'Camera': 'res/Camera.wav', 'Car': 'res/Car.wav', 'Carmen : Les Toreadors': 'res/Bizet.mid', 'Carmina Burana: O Fortuna': 'res/Orff.mid', 'Complete': 'res/Complete.wav', 'Complete 1': 'res/Complet1.mid', 'Complete 2': 'res/Complet2.mid', 'Csikos Post': 'res/Necke.mid', 'Dance of the Sugar Plum Fairy': 'res/TchaikoD.mid', 'Depressed': 'res/Emotion2.mid', 'Die Forelle(The Trout)': 'res/SchubeD.mid', 'Entry of the Gladiators': 'res/Fucik.mid', 'Excitement': 'res/Emotion1.mid', 'Exciting': 'res/Exciting.wav', 'For Elise': 'res/BeethF.mid', 'Four Seasons: Spring': 'res/Vivaldi.mid', 'Happy Birthday to You': 'res/Birthday.mid', 'Hungarian Dance No.5': 'res/Brahms5.mid', 'Itsy Bitsy Spider': 'res/Spider.mid', 'Jingle Bells': 'res/Jingle.mid', 'Joy': 'res/Emotion3.mid', 'Le Donna E mobile': 'res/Verdi.mid', 'Liebestraum No.3(Love Dream)': 'res/Liszt.mid', 'London Bridge is Falling Down': 'res/London.mid', 'Mary had a Little Lamb': 'res/Mary.mid', 'Minuet': 'res/Bocc.mid', 'Old MacDonald Had a Farm': 'res/OldMac.mid', 'Orpheus in the Underworld': 'res/BachO.mid', 'Piano Concerto': 'res/Grieg.mid', 'Piano Concerto No.1': 'res/Tchaiko1.mid', 'Piano Concerto No.21': 'res/Mozart21.mid', 'Piano Sonata No.16': 'res/Mozart16.mid', 'Pomp and Circumstance March': 'res/ElgarP.mid', 'Queen of the Night': 'res/MozartQ.mid', 'Robot': 'res/Robot.wav', "Salut d'Amour(Love's Greeting)": 'res/ElgarS.mid', 'Schubert: Lullaby': 'res/SchubeW.mid', 'Silver Waves': 'res/Wyman.mid', 'Siren': 'res/Siren.wav', 'Start': 'res/Start.wav', 'Start 1': 'res/Start1.mid', 'Start 2': 'res/Start2.mid', 'Success': 'res/Success.wav', 'Swan Lake : Scene': 'res/TchaikoS.mid', 'Sylvia : Pizzicato': 'res/Delibes.mid', 'Symphony No. 5: I': 'res/Beeth5.mid', 'Symphony No.40': 'res/Mozart40.mid', 'Symphony No.9': 'res/Dvorak.mid', 'The Cuckoo Waltz': 'res/Jonasson.mid', 'The Farmer in The Dell': 'res/Farmer.mid', 'The Washington Post': 'res/Sousa.mid', 'Toccata and Fugue in D minor': 'res/BachD.mid', 'Turkish March': 'res/MozartR.mid', 'Twinkle Twinkle Little Star': 'res/twinkle.mid', 'Waltz of the Flowers': 'res/TchaikoW.mid', 'Warning 1': 'res/Warning1.mid', 'Warning 2': 'res/Warning2.mid', 'We Wish You a Merry Christmas': 'res/Merry.mid', 'Wedding March': 'res/Mendel.mid', 'William Tell Overture': 'res/Rossini.mid', 'Win': 'res/Win.wav', 'Yankee Doodle': 'res/yankee.mid'}
PROPERTY_OFFSET_CURRENT_FREQUENCY = 2
PROPERTY_OFFSET_CURRENT_VOLUME = 0
PROPERTY_SPEAKER_MELODY = 19
PROPERTY_SPEAKER_MUSIC = 18
PROPERTY_SPEAKER_RESET = 17
PROPERTY_SPEAKER_SET_TUNE = 16
PROPERTY_SPEAKER_STATE = 2
SCALE_TABLE = {'DO#5': 554, 'DO#6': 1108, 'DO6': 1046, 'DO7': 2093, 'FA#5': 739, 'FA#6': 1479, 'FA5': 698, 'FA6': 1397, 'LA#5': 932, 'LA#6': 1864, 'LA5': 880, 'LA6': 1760, 'MI6': 1318, 'MI7': 2637, 'RE#5': 622, 'RE#6': 1244, 'RE6': 1174, 'RE7': 2349, 'SOL#5': 830, 'SOL#6': 1661, 'SOL5': 783, 'SOL6': 1567, 'TI5': 988, 'TI6': 1975}
STATE_PAUSE = 2
STATE_RESUME = 3
STATE_START = 1
STATE_STOP = 0
property frequency: int

Returns Current frequency

Returns:

Frequency value

Return type:

int

pause_music() None[source]

Pause music in speaker module

Returns:

None

play_music(name: str, volume: int) None[source]

Play music in speaker module

Parameters:
  • name (str) – Music name for playing

  • volume (int) – Volume of speaker

Returns:

None

static preset_musics() List[str][source]
static preset_notes() List[str][source]
reset() None[source]

Turn off the sound

Returns:

None

resume_music() None[source]

Resume music in speaker module

Returns:

None

set_tune(frequency: int | str, volume: int) None[source]

Set tune for the speaker

Parameters:
  • frequency (int) – Frequency value

  • volume (int) – Volume value

Returns:

None

stop_music() None[source]

Stop music in speaker module

Returns:

None

property tune: Tuple[int, int]
property volume: int

Returns Current volume

Returns:

Volume value

Return type:

int

Module contents