Closed filterbank10210 closed 2 years ago
Hi, have you tried to use the Edu API? For example:
from spherov2 import scanner
from spherov2.sphero_edu import SpheroEduAPI
toy = scanner.find_toy()
with SpheroEduAPI(toy) as api:
api.spin(360, 1)
Good day, superfashi
ok.. I did it this way toy=scanner.find_BOLT() api=SpheroEduAPI(toy) api.spin(360,1) error message: RuntimeError: Use toys in context manager
I tried using the above "with ... " statement ... it worked.. I do not need to use the enter() step, but it is unreliable. Some time it will give the following error: asyncio.exceptions.TimeoutError (the second problem I saw) then a retry with the same statement worked, but another following same statement may fail again with timeout.
This is still better then yesterday already. at least spin(360,1) can work.. and now I can explore the scripting more :> thanks
It is still abit weird to me as I thought that both the "with" style and the object api style should behave the same?
Sincerely appreciate your kind patience.
Best Regards filterbank10210
So the API is designed that when you use with
statement (context manager), it will connect to the toy and release resources when you exit. You have to use it with with
, basically.
OIC
thanks very much for the pointers!
Will close this topic then.
sincerely appreciated.
learnt the context handling herein.
Hi, just bought a BOLT in the hope my daughter will pick it up to learn some programming. Was hoping to impress her abit more with python scripting... but yeah... I come here begging for help :P
With the below version: OS: windows 10 Python version: 3.10.4 (IDLE shell) Bleak: 0.19.0 (and the dependencies) SPHEROV2: 0.11.4
I faced the below issues:
If there is any pointers or reference for me to look up or debug ... it is much appreciated.
semi-noop :P mostly used matplotlib for my plotting works... IO connectivity is kinda new to me ... like to use this opportunity to learn and improve myself too ... before I try to impress my daughter :>
NB: with the Sphero-Edu app... i can use the BOLT normally, so I am ure it is just the python env issue.