Skip to content

Error while Music Test #12

Description

@Tros-t

Hello.

My code:

from lib.mBot import * from multiprocessing import freeze_support if __name__ == '__main__': freeze_support() bot = mBot() #bot.startWithSerial("/dev/ttyUSB0") bot.startWithSerial('COM3') tones ={"C3":131,"D3":147,"E3":165,"F3":175,"G3":196,"A3":220,"B3":247, "C4":262,"D4":294,"E4":330,"F4":349,"G4":392,"A4":440,"B4":494, "C5":523,"D5":587,"E5":659,"F5":698,"G5":784,"A5":880,"B5":988} music = ["E4","E4","F4","G4","G4","F4","E4","D4","C4","C4","D4","E4","E4","D4","D4"] while(1): try: for i in range(0,len(music)): bot.doBuzzer(tones[music[i]],500) sleep(0.5) except Exception: bot.doBuzzer(0) bot.doBuzzer(0) sleep(3)

The Error:

Exception in thread Thread-1: Traceback (most recent call last): File "C:\Python37\lib\threading.py", line 926, in _bootstrap_inner self.run() File "C:\Python37\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "C:\Users\Ahmer Khan\Desktop\Arduino\python-for-mbot-master\lib\mBot.py", line 144, in __onRead r = ord(self.device.read()) File "C:\Users\Ahmer Khan\Desktop\Arduino\python-for-mbot-master\lib\mBot.py", line 45, in read return self.ser.read() File "C:\Python37\lib\site-packages\serial\serialwin32.py", line 285, in read ctypes.byref(self._overlapped_read)) TypeError: byref() argument must be a ctypes instance, not 'NoneType'

Help me pls

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions