First post, so I hope it's in the right location and makes sense!
I have a project that I am beginning that involves a Linux server being able to send commands to, and receive data from, a Feather setup with sensors. The commands will be sent from a bash script triggered by cron. Data will be read by another cron job and saved to disk. From the communications viewpoint, how do I make this work?
I have plugged in the Feather and it appears in 'dmesg' as '/dev/ttyACM0'. I started two consoles, one to 'echo' commands to, and the other to 'cat' the output from ACM0. This sort of works, but there is a lot more output than there should be, and it is bogus. So I think this is most likely not the way to go.
The test script I am using will output the time from the RTC when I type a specific character without hitting <Enter>. BTW, this does work correctly in the Arduino IDE serial monitor.
I've also briefly played with the UNIX/Linux application 'screen', which sort of works. I don't get the extraneous output, but I cannot get a shell script to run in it. I can get the RTC time manually.
I am sure someone has done this and got it working. I thought this might be the best place to ask, as Internet search results have not really helped much.
Thanks in advance! If more details are needed, specify what you want.
Linux PC communications with Feather
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Golf5Niner
- Posts: 3
- Joined: Sun Aug 20, 2017 2:17 pm
Re: Linux PC communications with Feather
After some additional testing, something I think is going on, is that when a command (single letter character) is sent from the Linux server to the Feather via 'echo', the output is somehow fed back into the input. Since the output contains the single letter used in the command, it causes another output, which causes yet another output, and so on. It stays in an infinite loop, and I have to just pull the USB cable.
So, why would the output be fed back into the input? Input is on one console, and output is on another. How could this be prevented?
Procedure on Fedora Server:
1. On console #1: run command 'stty -F /dev/ttyACM0 9600 raw'
2. On console #2: run background command 'cat < /dev/ttyACM0 &'
3. Back on console #1: run command to return some text 'echo G > /dev/ttyACM0' which should return the time from the RTC (real-time clock) on console #2
There is a command for the letter T, which is what causes the loop when it shows up in the text of the RTC time.
On another note more worrisome, sometimes when I am testing, the yellow LED on the Feather, charge LED maybe, will start flashing like it is responding to data. Kind of like the LEDs on an Arduino when a program is sent to it. This appears to be random, and I can't duplicate it that i know of.
Thanks again!
So, why would the output be fed back into the input? Input is on one console, and output is on another. How could this be prevented?
Procedure on Fedora Server:
1. On console #1: run command 'stty -F /dev/ttyACM0 9600 raw'
2. On console #2: run background command 'cat < /dev/ttyACM0 &'
3. Back on console #1: run command to return some text 'echo G > /dev/ttyACM0' which should return the time from the RTC (real-time clock) on console #2
There is a command for the letter T, which is what causes the loop when it shows up in the text of the RTC time.
On another note more worrisome, sometimes when I am testing, the yellow LED on the Feather, charge LED maybe, will start flashing like it is responding to data. Kind of like the LEDs on an Arduino when a program is sent to it. This appears to be random, and I can't duplicate it that i know of.
Thanks again!
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Linux PC communications with Feather
The yellow LED shows the status of the onboard LiPo charger. If you don't have a LiPo attached, it will blink randomly in response to voltage fluctuations in the Feather. It's nothing to worry about.
`stty` can echo characters being sent back to the sender (so you can see what you're typing, for instance). The '-echo' option should shut that off.
`stty` can echo characters being sent back to the sender (so you can see what you're typing, for instance). The '-echo' option should shut that off.
- Golf5Niner
- Posts: 3
- Joined: Sun Aug 20, 2017 2:17 pm
Re: Linux PC communications with Feather
Thank you so much, Mike! Adding the parameter "-echo" resolved the issue nicely. That shows it pays to take note of the details in the "man" pages - I looked at the one for stty, but there was soooo much, I guess my eyes just glazed over!
Thanks also for clarifying the LED on the Feather. i was worried that I broke it somehow.
Thanks again! :cool:
Thanks also for clarifying the LED on the Feather. i was worried that I broke it somehow.
Thanks again! :cool:
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Linux PC communications with Feather
Glad to hear everything is working for you. Happy hacking!
Please be positive and constructive with your questions and comments.