Pages: [1]   Go Down
Author Topic: Ubuntu serial output.  (Read 472 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi
i basically want to know how i can make Ubuntu output to the serial port every min the CPU Load

You can run this command to find the load

Quote
uptime | sed -e "s/.*load average: \(.*\...\), \(.*\...\), \(.*\...\)/\1/" -e "s/ //g"

How would i do this?

Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 29
Posts: 2589
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Not sure, try:
uptime | sed -e "s/.*load average: \(.*\...\), \(.*\...\), \(.*\...\)/\1/" -e "s/ //g" > /dev/ttyACM0
Logged

CO, USA
Offline Offline
God Member
*****
Karma: 5
Posts: 711
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's an example doing something trivial:
Code:
$ while true; do echo wibbly; sleep 10; done

This works in bash. You might need to enclose your command in parentheses. Like
Code:
$ while true; do (uptime | sed -e "s/.*load average: \(.*\...\), \(.*\...\), \(.*\...\)/\1/" -e "s/ //g" > /dev/ttyACM0); sleep 60; done

Also, I don't think you'll be guaranteed that ACM0 will always be your Arduino. On my Ubuntu sytem, it's always the next higher number everytime I unplug/plug it in.
Logged

... it is poor civic hygiene to install technologies that could someday
facilitate a police state. -- Bruce Schneier

0
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Changed to my arduino number and this command worked smiley

Now i just got to make it a looping SH Script smiley

Tyvm - Ryan
Logged

Pages: [1]   Go Up
Jump to: