File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from pyqt .qt import Window , RuntimeData
12from game .game import Game
23from colorama import Fore
34import pygame as pg
5+ import struct
6+
47import serial
58
69
710def main ():
8- game : Game = Game (octaves_to_diplay = 3 )
11+ launcher : Window = Window ()
12+ runtime_data : RuntimeData = launcher .run ()
13+
14+ mcu_port : str = runtime_data .mcu_port
15+ try :
16+ serial_port : serial .Serial = serial .Serial (mcu_port , 115200 , timeout = 1 )
17+ except serial .SerialException as error :
18+ print (f"{ Fore .RED } Invalid MCU port: { error } " )
19+ return
20+
21+ game : Game = Game (octaves_to_diplay = runtime_data .octaves )
922 while game .is_running :
10- print (game .run ())
23+ played_frequency : float = game .run ()
24+ packed_data = struct .pack ("<f" , played_frequency )
25+ serial_port .write (packed_data )
26+ print (played_frequency )
1127 pg .quit ()
1228
1329
You can’t perform that action at this time.
0 commit comments