I'm looking for a quick and dirty way to capture serial data over the USB serial, or a bluetooth serial connection in linux.
I can use 'cat' in a loop, but apparently it drops a lot of lines.
The serial monitor in arduino works, but I want something from a command line.
I can write something in java, but serial is kinda clunky in java, and I really just want a quick-and-dirty solution. Anyone have any ideas?
I tried ttylog, which I suspect is working, but the text is garbled, as if it's expecting binary.
Here's the basic sketch:
Using cat like below
I get something like this
Using
"ttylog -b 9600 -d /dev/ttyACM0"
I get something like this:
I can use 'cat' in a loop, but apparently it drops a lot of lines.
The serial monitor in arduino works, but I want something from a command line.
I can write something in java, but serial is kinda clunky in java, and I really just want a quick-and-dirty solution. Anyone have any ideas?
I tried ttylog, which I suspect is working, but the text is garbled, as if it's expecting binary.
Here's the basic sketch:
Code:
int i=0, msecElapseFromStart=0;
int msecElapseFromPrior = 0;
void setup() {
while (!Serial && (millis () <= 3000));
Serial.begin(9600);
}
void loop() {
msecElapseFromPrior = millis() - msecElapseFromStart;
if (msecElapseFromPrior >= 100) { // update LCD once per half-second independent of read rate
Serial.print("0");
Serial.print(",");
Serial.print("1");
Serial.print(",");
Serial.print(i);
Serial.print(",");
Serial.print(msecElapseFromPrior);
Serial.print(",");
Serial.println(msecElapseFromStart);
Serial.flush();
i++;
msecElapseFromStart = millis();
}
}
Using cat like below
Code:
#!/bin/sh
echo "Usage: <program> <OUTPUT>"
INPUT="/dev/ttyACM0"
OUTPUT="$1"
while true; do
cat "$INPUT" >> "$OUTPUT"
done
I get something like this
Code:
0,1,0,809,0
0,1,6,100,1309
0,1,7,100,1409
0,1,27,100,3409
0,1,49,100,5609
0,1,56,100,6309
0,1,58,100,6509
0,1,65,100,7209
0,1,89,100,9609
0,1,91,100,9809
Using
"ttylog -b 9600 -d /dev/ttyACM0"
I get something like this:
Code:
X<o��
X<o��
X<o��
X<o��
X<o��
X<o��
X<o��
X<o��
X<o��