Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
#include
#include
#include
using namespace std; int num=0; int val=0; double sum=0; double avg=0.0; double stDev=0.0; double err=0.0; ifstream myFile_Handler; int ReadSensor(string FileName); int main(){ string FileX="/sys/bus/iio/devices/iio:device2/in_accel_x_raw"; string FileY="/sys/bus/iio/devices/iio:device2/in_accel_y_raw"; string FileZ="/sys/bus/iio/devices/iio:device2/in_accel_z_raw"; for (;;){ cout << " X: " << ReadSensor(FileX) << " Y: " << ReadSensor(FileY) << " Z: "<< ReadSensor(FileZ) << endl; sleep(1); cout << "\x1b[A" << "\33[2K\r" << std::flush; } return 0; } int ReadSensor(string FileName){ int val; ifstream myFile_Handler; string myLine; myFile_Handler.open(FileName); // /sys/bus/iio/devices/iio\:device2/in_accel_x_raw if(myFile_Handler.is_open()) { while(getline(myFile_Handler, myLine)){ val = std::stoi(myLine); } myFile_Handler.close(); } else { cout << "Unable to open the file!"; } return val; }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)