Question: Write a program which blinks the on board LED according to the user button on the ST Nucleo-F401RE board. Write a program that blinks the

Write a program which blinks the on board LED according to the user button on the ST Nucleo-F401RE board.

Write a program that blinks the on-board LED while the user button is being pressed.

For this program you will need to create one DigitalIn and one DigitalOut objects connected to PC13 and PA5 respectively. Since the buttons on the board have no external pull-up resistor, the pins have to be configured as inputs with internal pull-up resistor. It can be done by using the mode() function when creating a button. Inside the main function, you will have an infinite loop:

int main()

{ while(1)

{ //do something } }

Inside the loop you will constantly check the state of the button and toggle the LED according

Pseudo-code of the program:

If button is pressed, toggle the state of the LED

ELse turn off the LED

Wait 250ms

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!