hello, i apologize in advance for the noob question. I did some googling and searched the forums a bit, but could not find quite what I was hoping to find. I have a lm35 temp sensor connected to a mega 2560 connected via USB to Ubuntu 14.04 x64
stty info for catting /dev/ttyACM2
stty -F /dev/ttyACM2 cs8 9600 sane ignbrk -brkint -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts
sketch is
void setup() {
Serial.begin(9600);
}
void loop() {
int val;
int dat;
val=analogRead(0);//Connect LM35 on Analog 0 temp sensor
dat=((500*val)/1000)*1.8+32; // do some math for degrees in F
Serial.println(dat); // print output to serial
delay(1000);
}
When I cat /dev/ttyACM2 the following output is received,
cat /dev/ttyACM2
73
73
73
73
73
I was hoping I could find a way to have the output formatted without the extra blank line, like this.
cat /dev/ttyACM2
73
73
73
73
73
If I run it with Serial.print it produces
7373737373
Is there anyway to remove the blank line in between the output of the first example?
In MySQL I'm getting the following which I'm assuming is due to the blank line in the output when I cat the serial device.
| 33.00 | 2014-10-29 18:27:27 |
| | 2014-10-29 18:27:27 |
| 33.00 | 2014-10-29 18:27:28 |
| | 2014-10-29 18:27:28 |
| 33.00 | 2014-10-29 18:27:29 |
| | 2014-10-29 18:27:29 |
| 33.00 | 2014-10-29 18:27:30 |
| | 2014-10-29 18:27:30 |
I have successfully retrieved data from serial using other methods, but they seem really clunky. like using bash, catting and grepping output to a series of files before inserting them into mySQL which work. I was hoping to eliminate doing it that way. I am aware there are other ways using python, php, json, and java but I'm hoping to work through this with bash only.
Thanks for the help.