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

#include"led.h"
#include<string>
using namespace std;
int main(int argc, char* argv[]){
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;
}