Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout error #43

Open
happy-jin1234 opened this issue Aug 10, 2023 · 2 comments
Open

Timeout error #43

happy-jin1234 opened this issue Aug 10, 2023 · 2 comments

Comments

@happy-jin1234
Copy link

i'm using microbit 1.5v
and here is my code

import microbit
import pyautogui 
import pydirectinput
import time

while True:
    if microbit.button_a.is_pressed():
        pydirectinput.keyDown('s')
        time.sleep(0.2)
        pydirectinput.keyUp('s')
    elif microbit.button_b.is_pressed():
        pydirectinput.keyDown('w')
        time.sleep(0.2)
        pydirectinput.keyUp('w')

it runs correctly but few minutes after it's got an error

connecting...
Your micro:bit has been detected
Now running your program
Traceback (most recent call last):
  File "c:\Users\진\Downloads\bitio-master\src\counter.py", line 13, in <module>
    elif microbit.button_b.is_pressed():
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\진\Downloads\bitio-master\src\microbit\api.py", line 53, in is_pressed
    r = self.parent.cmd("print(%s.is_pressed())" % self.name)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\진\Downloads\bitio-master\src\microbit\api.py", line 30, in cmd
    r = self.repl.wait_response()
        ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\진\Downloads\bitio-master\src\microbit\repl\repl.py", line 168, in wait_response
    self.receive("OK", timeout=1, min_length=2)
  File "c:\Users\진\Downloads\bitio-master\src\microbit\repl\repl.py", line 82, in receive
    raise REPLException("Timeout trying to receive [%s]" % buffer)
microbit.repl.repl.REPLException: Timeout trying to receive [?bitio (c) 2017 David Whale
MicroPython v1.7-9-gbe020eb on 2016-04-18; micro:bit with nRF51822
Type "help()" for more information.
>>> ]
@whaleygeek
Copy link
Owner

Looks like you pressed the reset button or the micro:bit rebooted, as the response includes the bootup message.

Check the reset button is not accidentally pressed, or perhaps you shorted 0V and 3V somehow and it caused a reboot.

@happy-jin1234
Copy link
Author

It is correct that the reset button was pressed. thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants