Question

In: Electrical Engineering

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

write a program for the msp430fr6989

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

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

Solutions

Expert Solution

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


Related Solutions

a) Create a program for the msp430FR6989 .You will use need to program it to be...
a) Create a program for the msp430FR6989 .You will use need to program it to be able to use a external pulse switch to start/stop the blinking of LED1, and a second pulse switch to control the blinking of LED2. b) Modify Program #1 (b) to blink the number of times on the data switches once the pulse switch is engaged
write a program for the microcontroller-msp430fr6989 using code composer studio not assembly language. write a code...
write a program for the microcontroller-msp430fr6989 using code composer studio not assembly language. write a code that transmits a single character and lights the red LED upon receiving that character. The board will "talk" to itself. The green LED should turn on whenever a message is sent and the LCD will display the message being received.
using code composer studio 1. write a program for the msp430fr6989 that will light LED1, whenever...
using code composer studio 1. write a program for the msp430fr6989 that will light LED1, whenever S1 is pressed. It should turn off whenever S1 is released. 2. Write a program that will make LED1 blink 5 times when S1 is pressed, and then stop.
Without using a Timer function, write a program to read the distance from the HC-SR04 ultrasonic...
Without using a Timer function, write a program to read the distance from the HC-SR04 ultrasonic sensor and display the distance on the C12832 lcd. *please refer the HC-SR04 datasheet for the operation of the ultrasonic sensor, and mbed website for C12832 library and Timer function
1. write a program for the msp430fr6989 that will light LED1, whenever S1 is pressed. It...
1. write a program for the msp430fr6989 that will light LED1, whenever S1 is pressed. It should turn off whenever S1 is released. 2. Write a program that will make LED1 blink 5 times when S1 is pressed, and then stop.
write a Program in C++ Using a structure (struct) for a timeType, create a program to...
write a Program in C++ Using a structure (struct) for a timeType, create a program to read in 2 times into structures, and call the method addTime, in the format: t3 = addTime(t1, t2); Make sure to use add the code to reset and carry, when adding 2 times. Also, display the resultant time using a function: display(t3);
Write a java program using the following instructions: Write a program that determines election results. Create...
Write a java program using the following instructions: Write a program that determines election results. Create two parallel arrays to store the last names of five candidates in a local election and the votes received by each candidate. Prompt the user to input these values. The program should output each candidates name, the votes received by that candidate, the percentage of the total votes received by the candidate, and the total votes cast. Your program should also output the winner...
1.write a program for the msp430FR6989 to make led 1 blink at 50 percent duty cycle....
1.write a program for the msp430FR6989 to make led 1 blink at 50 percent duty cycle. 2 modify the program to make led 1 blink 5 times, make a long pause, then blink 5 more times then stop. The time delays should be carried out in subroutines
Create a schematic of a circuit using and write C program to run on a PIC...
Create a schematic of a circuit using and write C program to run on a PIC 16F88 that will flash between a red and green LED at 5Hz with the green on 75% of the time and the red on 25% of the time.
USING PYTHON Write a program to create a number list. It will call a function to...
USING PYTHON Write a program to create a number list. It will call a function to calculate the average values in the list. Define main ():                        Declare variables and initialize them                        Create a list containing numbers (int/float)                        Call get_avg function that will return the calculated average values in the list.                                       Use a for loop to loop through the values in the list and calculate avg                        End main()
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT