Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int GPIOClass::getval_gpio(string& val){
- string getval_str = "/sys/class/gpio/gpio" + this->gpionum + "/value";
- ifstream getvalgpio(getval_str.c_str());// open value file for gpio
- if (getvalgpio < 0){
- cout << " OPERATION FAILED: Unable to get value of GPIO"<< this->gpionum <<" ."<< endl;
- return -1;
- }
- getvalgpio >> val ; //read gpio value
- if(val != "0")
- val = "1";
- else
- val = "0";
- getvalgpio.close(); //close the value file
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement