diff --git a/main.cpp b/main.cpp index 0fcdf25..0a54667 100644 --- a/main.cpp +++ b/main.cpp @@ -3,24 +3,36 @@ using namespace std; int main(int argc, char* argv[]){ - CLED led1 = CLED(3); - string cmd(argv[1]); - - if(argc!=2) - std::cout << "Incorrect number of arguments" << std::endl; - - if(cmd=="on") - led1.TurnOn(); - - else if(cmd=="off") - led1.TurnOff(); - - else if(cmd=="blink") - led1.BlinkLED(); - else - cout << "Invalid command" << endl; + if(argc!=2){ + std::cout << "Error: This is not a command for this application" << std::endl; + std::cout << "These are the commands you can use: on, off and blink" << std::endl; + } + + std::cout << "Starting app" << std::endl; + string cmd(argv[1]); + + CLED leds[4] = {CLED(0), CLED(1), CLED(2), CLED(3)}; + + for(int i=0; i<=3; i++){ + if(cmd=="on") + leds[i].TurnOn(); + + else if(cmd=="off") + leds[i].TurnOff(); + + else if(cmd=="blink") + leds[i].BlinkLED(); + + else{ + std::cout << "Error: Invalid command" << std::endl; + std::cout << "These are the commands you can use: " << std::endl; + std::cout << "on - Powers on the LED" << std::endl; + std::cout << "off - Powers off the LED" << std::endl; + std::cout << "blink - Makes the LED blink" << std::endl; + } + } return 0; }