Hi Dave,
Thanks for all your hints!! - unfortunately this is not the issue as well (I've tried all variables everywherer..
Maybe I failed to explain the problem correctly: How do I send information from my pyboard to a program running on my PC (the latter being written in python, of course...).
I connect by USB cable using screen to the pyboard. When I enter tmp = usb.send(b'testup') - I want the string "testup" to appear in the programm running at my pc and not on the pyboard in the variable tmp.
Any ideas?
Greatings from Hambug to Canada!
Ulrich
UART - sending from pyboard to PC
Re: UART - sending from pyboard to PC
Why don't you use a real UART on the pyboard, and connect it to your PC using a USB-TTL cable (FTDI)? This way, you keep your usb line for console and program transfert (using pyboard.py), and you have a dedicated serial line to send your own commands...
Frédéric
Re: UART - sending from pyboard to PC
The issue is that you can't connect to the pyboard's serial device (/dev/ttyACM0) with 2 different programs. In this case your 2 different programs are "screen" (to get the REPL), and your script running on your PC.
Try the following:
On pyboard run this:
Then make sure you quit from screen/picocom/minicom.
Then run this on your PC:
That should work: you should get "hello\n" returned back to your PC.
Try the following:
On pyboard run this:
Code: Select all
>>> usb = pyb.USB_VCP()
>>> def output():
... while True:
... usb.write("hello!\n")
... pyb.delay(1000)
...
>>> output()
Then run this on your PC:
Code: Select all
>>> import serial
>>> ser = serial.Serial('/dev/ttyACM0',9600, timeout=1)
>>> ser.readline()
Re: UART - sending from pyboard to PC
Great! Thanks a lot, this did it! Problem solved!
Knowing it now, it seems so obvious....
Knowing it now, it seems so obvious....
Re: UART - sending from pyboard to PC
As soon as I get permission I can post up some progress I made with the hc05. Admin has me locked out from the new registration process.
Re: UART - sending from pyboard to PC
@Adam - looks like your posts are showing up now. I think that once a new user has two posts that clear moderation then you can post freely.
-Bryan
-Bryan
Re: UART - sending from pyboard to PC
Does someone have a simple example of reading a sensor, for instance the built-in-accelerometer, and sending the value back to the computer (reading with a python-program based on pyserial)?
Poul Riis
Poul Riis
Re: UART - sending from pyboard to PC
I still looking this thread, thanks for sharing