![]() ![]() (without the python annotication), eg: ``` Here between triple backticks as you’ve doing with your Python code Text, so you can copy/paste from the putty window’s text. We much prefer plain text inline to screenshots. I’m assuming this is Windows-(wifi/ssh)->Rpi-(serial)->Arduino. So, what can I do/change to try to make this work? I assume is on the ser.write() command! No Rx line at all! But while using the script above, I only see Tx line blinking. What I see is, while using minicom, is the opposite: “getData” on Tx line and the JSON object on the Rx line. When I added the (?) above, I meant that I was expecting to see the string “getData” on the Rx line of the Arduino and the JSON object on the Tx line of the Arduino. I can only catch the JSON object reply when using minicom, on my scope! ![]() The problem is that I can’t even catch the “getData” string reaching the Rx line of Arduino on my scope (at home), using the script! I can’t also catch it if I use minicom where I can see the Tx (?) led blinking per each charater of the string “getData” that I type in minicom window. This is the result, after the timeout of 10 secs: $ python3 serialWriteRead.py Val = ser.write(command.encode(encoding = 'ascii', errors = 'strict')) So, I have this code for now, in a single script: import serial I don’t want to detail all the things I tried because the post will become huge and nobody will read it. So far, I was not able to reproduce this behaviour with a single script, so I tried to split the script in 2 so that I could run both at the same time. Send “getData” to Arduino serial, wait for the JSON object, fetch it into a variable and print it out to the terminal window. So, the goal is, with a single script, to mimic this behavior. If I type something else I just get a “Not detected” message. We don’t see the string “getData” here because I deactivated local Echo in minicom. Meaning that if I send the string “getData” to Arduino serial port via minicom, I get the JSON object back at minicom. Other than that, I just wrote a small program to try to mimic the program my colleague uploaded on Arudino at work. On my free time, I’m also trying to do the same at home, but I use Debian instead of Windows and therefore, I use minicom instead of Putty. I don’t have a screenshot of the result from work, though! The Arduino Uno has a code that is prepared to send a JSON object to its serial port when it catches a string “getData” on its serial port! So, my colleague asked me to write a script to automatically send this string and fetch the JSON object into a variable.Īt work I was able to get the JSON object in Putty even if completely out of format, but I got it, using 2 separate scripts (goal is to use only one). We use Windows computers, so we are connecting to Rpi 4 via Putty. They are conencted via USB cable and we connect to the Rpi 4 via work Wireless network. We are working with an Arduino Uno and a Rpi 4. I’m kind of new to Python and Arduino but I started to work recently with these two, so I need some help. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |