-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
[Question] Does pybricks.experimental import getchar still exist? #376
Comments
Hi,
PS: I also noticed that some of the Color Sensor handling changed, but I worked my way through that using the new docs ;0) |
What is |
Looks like version = "0.1.0"
|
I don't think |
Actually I started off using the notebook RC demo but then converted it to a normal Python program in the same project folder with the notebook stuff. |
If you just want to download and run a program, you can use I guess I would need to see the whole project folder to be able to tell you what needs to be done to fix it. |
Ok well it looks like current situation is that the pybricksdev package can do a hub.run command ok but after that we can just read outputs from the hub but not send any commands to it. Since I updated the hub and not the pybricksdev on my PC, I would assume the changes to the hub software is causing this, or pybricksdev needs a fix to work with updated hub sw as you mention in pybrickdev#17 above. Command line mode does not really help with getting the RC thing going. I suppose I could try using the browser based environment which I assume would work using the example given above by Laurens. Copy my Hub program over and run it in that environment for now? |
The issue I referenced only applies to the command line mode, but yes, we recommend using https://code.pybricks.com or https://beta.pybricks.com. |
Ok I am using code.pybricks.com and also the app program. |
Currently, you have to change the "Ask where to save each file before downloading" setting in your browser to get "save as". |
It looks like we removed the In the mean time, you can do it yourself like this: from pybricksdev.ble import nus
await hub.client.write_gatt_char(nus.NUS_RX_UUID, bytearray(b"HELLO!"), True) Here is a minimal working example: |
This is expected to change eventually though, when we enable hub-to-hub communication. Then, your PC will be able to communicate to the hub in the same way, and independent from the whole download-and-run process, making it all a bit more reliable. |
This got removed when we upgraded the download and run protocol. This can be used to send data to the hub, until we support full hub-to-hub communication. pybricks/support#376 Also update the notebook demo while we are at it. This removes the USB example for SPIKE.
@laurensvalk
PS: I am looking forward to new hub-to-hub methods which should open up a lot of interesting possibilities. |
Indeed, you may not need to check for the run state anymore. But if you find that you still need it, how about putting something like this as the first line of your program? print(“started!”) and then check for that output before you send anything important to the hub. |
there is now a boolean |
Hi guys, |
Sorry to bother you all again. from pybricksdev.connections import PybricksHub
from pybricksdev.ble import find_device
from asyncio import gather, sleep, run
import msvcrt
hub_RUNNING = 1
async def main():
print('main: Start')
hub = PybricksHub()
# You can search for the address like this:
address = await find_device('Pybricks Hub')
await hub.connect(address)
await gather(
hub.run('robot.py', print_output=True),
forwarder(hub)
)
# Disconnect from the hub
await hub.disconnect()
print('main: Stop')
|
Try this: device = await find_device()
await hub.connect(device) If that doesn't work, enable Bleak logging: https://bleak.readthedocs.io/en/latest/troubleshooting.html |
Ok that worked ;0) |
We added it back just yesterday after you asked, so it sounds like you’ve found the latest version indeed 😄 |
Good timing for me ;0) |
EV3 and SPIKE are skipped for now since there are pending pull requests. Lines are wrapped somewhat short at 70 lines for better compatibility with the website.
Does "from pybricks.experimental import getchar" still work?
Updated my Robot Inventor Hub using https://install.pybricks.com/
The getchar function does not seem to exist now but I would like to use it for Remote control.
Do I need a special version?
I don't see getchar in the documentation either.
Thanks.
The text was updated successfully, but these errors were encountered: