Go Down

Topic: Ubuntu serial output. (Read 522 times) previous topic - next topic

ryanteck

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?


Magician

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

justjed

Here's an example doing something trivial:
Code: [Select]

$ while true; do echo wibbly; sleep 10; done


This works in bash. You might need to enclose your command in parentheses. Like
Code: [Select]

$ 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.
... it is poor civic hygiene to install technologies that could someday
facilitate a police state. -- Bruce Schneier

ryanteck

Changed to my arduino number and this command worked :)

Now i just got to make it a looping SH Script :)

Tyvm - Ryan

Go Up