Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //============================================================================
- // Name : TestApp.cpp
- // Author : Norbi
- // Version :
- // Copyright : Hmm
- // Description : Hello World in C++, Ansi-style
- //============================================================================
- #include <iostream>
- #include <stdio.h>
- using namespace std;
- int main() {
- cout << "Motor driver starts" << endl; // prints !!!Hello World!!!
- FILE *LEDHandle = NULL;
- char *LEDBrightness = "/sys/class/leds/beaglebone:green:usr3/brightness";
- for(int i=0; i<10; i++){
- if((LEDHandle=fopen(LEDBrightness,"r+"))=NULL){
- fwrite("1",sizeof(char),1,LEDHandle);
- fclose(LEDHandle);
- sleep(1);
- }else{
- cout << "cant work with the led" << endl;
- }
- if((LEDHandle=fopen(LEDBrightness,"r+"))=NULL){
- fwrite("0",sizeof(char),1,LEDHandle);
- fclose(LEDHandle);
- sleep(1);
- }else{
- cout << "cant work with the led" << endl;
- }
- }
- cout << "Motor driver stops" << endl;
- return 0;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement