You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
889 B

2 years ago
2 years ago
  1. #include"led.h"
  2. #include<string>
  3. using namespace std;
  4. int main(int argc, char* argv[]){
  5. if(argc!=2){
  6. std::cout << "Error: This is not a command for this application" << std::endl;
  7. std::cout << "These are the commands you can use: on, off and blink" << std::endl;
  8. }
  9. std::cout << "Starting app" << std::endl;
  10. string cmd(argv[1]);
  11. CLED leds[4] = {CLED(0), CLED(1), CLED(2), CLED(3)};
  12. for(int i=0; i<=3; i++){
  13. if(cmd=="on")
  14. leds[i].TurnOn();
  15. else if(cmd=="off")
  16. leds[i].TurnOff();
  17. else if(cmd=="blink")
  18. leds[i].BlinkLED();
  19. else{
  20. std::cout << "Error: Invalid command" << std::endl;
  21. std::cout << "These are the commands you can use: " << std::endl;
  22. std::cout << "on - Powers on the LED" << std::endl;
  23. std::cout << "off - Powers off the LED" << std::endl;
  24. std::cout << "blink - Makes the LED blink" << std::endl;
  25. }
  26. }
  27. return 0;
  28. }