Read output from ttyUSB0

After installing one relay board in respberry pi I tested with success some commands to open and close the relays but I found one problem. I do not receive the status of the eight relays or the status of single relay. How can I fix this?

The permission that I added in ttyUSB0 #chmod o+rwx /dev/ttyUSB0

#!/bin/bash stty -F /dev/ttyUSB0 9600 # Command to get the status of eight relays. echo -e '\xff\x09\x00' > /dev/ttyUSB0 while true; do cat /dev/ttyUSB0 done exit

Note: in C code the output works fine.


If you are trying to get the status you should be sending: echo -e '\xff\x01\x03' > /dev/ttyUSB0

Category:linux Time:2018-12-04 Views:0

Related post

  • Reading output from console program 2009-10-15

    I need to read output from native C++ console application in my C++/.NET. There are many articles about this, but most wait until the process ends to read the output, which I don't want to, I need to read it immediately after it is "cout-ed" by the p

  • Reading output from geometry shader on CPU 2009-09-04

    I'm trying to read the output from a geometry shader which is using stream-output to output to a buffer. The output buffer used by the geometry shader is described like this: D3D10_BUFFER_DESC vbdesc = { numPoints * sizeof( MESH_VERTEX ), D3D10_USAGE

  • Read output from svn into a string 2009-10-07

    Ok, so after my idea of SSHing to a server and using the svn command line client instead of remote desktop (not much of an idea tbh), me and my boss have decided it would be rather better if we could update each project from a single local web-page (

  • Hadoop 0.2: How to read outputs from TextOutputFormat? 2010-04-09

    My reducer class produces outputs with TextOutputFormat (the default OutputFormat given by Job). I like to consume this outputs after the MapReduce job complete to aggregate the outputs. In addition to this, I like to write out the aggregated informa

  • bi-directional communication using socketpair: hangs reading output from child process 2010-08-27

    I'm trying to use a socketpair to have a parent process provide input to a child process that execs a different program (e.g., grep) and then read the resulting output. The program hangs in the while loop that reads the output from the program that t

  • Can't read output from console command runned from code 2011-01-14

    I'm building a small Console Application that sometimes will use the Windows Command Line, to send a command and then receive and display the output. Opening a new Command Line instance was easy, sending commands from my Application took a bit of dig

  • Reading output from console application and WPF plotting async 2011-02-19

    I have a console application which outputs about 160 lines of info every 1 second. The data output is points that can be used to plot on a graph. In my WPF application, I've successfully have this hooked up and the data output by the console applicat

  • reading output from a text file 2011-02-25

    For instance, the following script can be displayed at ../cgi-bin/, but is there a way I could display the same output from a text file (like test.txt) instead of, so that the url would be something like ../text.txt? --- test.p

  • Reading output from the command line 2011-12-28

    I'm trying to write a simple GUI for Wget. I'm looking for advice on how to read information from the command line output that Wget generates when it is doing a run. I'd like to update that download information real time to a list box or some equival

  • Read output from external process 2012-04-30

    I am trying to run a .csh script and read it's output into a StringBuffer. the output sometime returns empty although running the script from console returns some output. the same running flow can sometimes returns output and sometimes not, although

  • QProcess: how to read output from pactl 2014-04-22

    I am trying to run this bash command $pactl list sinks short | grep 10_B7_F6_02_1B_4A in my c++ project using QProcess and to get the output using readAllStandardOutput() as shown in this post. When I put echo at the beginning of the command and put

  • python, subprocess: reading output from subprocess 2010-09-27

    I have following script: #!/usr/bin/python while True: x = raw_input() print x[::-1] I am calling it from ipython: In [5]: p = Popen('./', stdin=PIPE) In [6]: p.stdin.write('abc\n') cba and it works fine. However, when I do this: In [7]: p =

  • I want to read output from a console-mode child process 2011-03-18

    I am trying to update a program which was written in 1995 with pascal or c. I am not sure about programming language. Command line program. Now I am coded in C#. And I want to read child program output. Is it possible? I tried something. But not succ

  • Reading output from java.lang.Process - There is nothing to read 2012-03-05

    I'm trying to execute terminal command in linux trough Java and i cant get any input from inputStream. This is my code ProcessBuilder build = new ProcessBuilder("/usr/bin/xterm", "find /home"); Process pr = null; BufferedReader buf; try { build.redir

  • AJAX Progress: Reading output from the Shell 2009-02-07

    Objective: Make a progress bar where users can check how much of a file has been downloaded by my server. Scenario:I have a PHP script that executes a python script via popen. I have done this like so: $handle = popen('python last', 'r'); $read = fre

  • read output from a class executed as a process 2011-11-09

    I am using Runtime.getRuntime().exec(test.class) to create a process and launch a test.class file. test.class: public class test { public static void main(String[] args) { doReturn(); } public static String doReturn() { System.out.println("printed ou

  • How to read output from bzcat instead of specifying a filename 2012-02-20

    I need to use 'last' to search through a list of users who logged into a system, i.e. last -f /var/log/wtmp <username> Considering the number of bzipped archive files in that directory, and considering I am on a shared system, I am trying to in

  • How to read output from Excel file into Fortran? 2012-03-04

    I have an excel sheet with the following columns for a stock chart: Open High Low Close Day Average How do i use Fortran to pull only the "Day Average" from the excel file? I am new to Fortran and haven't been able to find anything that could help ex

  • Reading output from already running .exe 2014-12-01

    Short and simple Basic outline of what I'm doing: actionscript --> c# (hey execute c++ and send me the info it gives to you) c# ---> c++ (hey wake up! run your code with a set of parameters and I'll read your info into a text file for use later

Copyright (C), All Rights Reserved.

processed in 2.037 (s). 14 q(s)