write a program for the msp430fr6989 Using the general purpose timer, specifically the ACLK, create a program...

Free

60.1K

Verified Solution

Question

Electrical Engineering

write a program for the msp430fr6989

Using the general purpose timer, specifically the ACLK, create aprogram which makes LED1 stay on for 4 seconds and off for 2seconds and repeat indefinitely.

Modify the above program to extend the timing to 20 and 10seconds, respectively.

Answer & Explanation Solved by verified expert
3.9 Ratings (788 Votes)

void setup() {

pinMode(led1, OUTPUT); // initialize digital pin led1 as an output.

int counter=0;

}

void loop()

{

  digitalWrite(led1, HIGH);   // turn the led1 on (HIGH is the voltage level)

  delay(4000);              // led1 stay on for 4seconds=4000 milliseconds

  digitalWrite(led1, LOW);    // turn the led1 off by making the voltage LOW

  delay(2000);              // led1 stay off for 2 seconds=2000 milliseconds

counter++; // this statement makes the program indefinetely repeat itself

}

Now program for 20 seconds ON and 10 seconds OFF is shown below

void setup()

{   

pinMode(led1, OUTPUT);

int counter=0;

}

void loop()

{

digitalWrite(led1, HIGH);

delay(20000); // 20 seconds = 20000 milliseconds

digitalWrite(led1, LOW);

delay(10000); // 10seconds =10000 milliseconds

counter++;

}

IF YOU HAVE QUERY PLEASE POST A COMMENT , LIKE MY ANSEWER THANKS IN ADVANCE


Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students