Question: Q2. Write the code so that the mbed counts up and displays the number as 4-bit binary on the four on- board LEDs. At the

 Q2. Write the code so that the mbed counts up and

Q2. Write the code so that the mbed counts up and displays the number as 4-bit binary on the four on- board LEDs. At the same time, the mbed sends these numbers through the serial USB cable to be displayed on the terminal of the pc, one on each line as shown below. Whenever the counter reaches its full count or user hits the 0-key, the mbed restarts counting from zero. Note >> the getc() function waits for user input. Therefore, it would be better to check first if the terminal is sending some data and this can be done with readable () function. If you hit a key, then readable()-1, otherwise readable ()-0 This can be accomplished with: if (pc. readable()-1) c=pc.getc ( ); // pc is a serial object ?COM35 . Tera Term VT File Edit Setup Control Window He ounter-8 counter-1 ounter-2 ounter 3 ounter-8 ounter-1 ounter 2 ounter-3 At this moment, the user has pressed on the 0-key #include "mbed.h" Busout leds (LED4, LED3, LED2, LEDI): Serial pc (USBTX, USBRX) int main(0 1. Add the code here... 2. Add snapshot for all outputs... Q2. Write the code so that the mbed counts up and displays the number as 4-bit binary on the four on- board LEDs. At the same time, the mbed sends these numbers through the serial USB cable to be displayed on the terminal of the pc, one on each line as shown below. Whenever the counter reaches its full count or user hits the 0-key, the mbed restarts counting from zero. Note >> the getc() function waits for user input. Therefore, it would be better to check first if the terminal is sending some data and this can be done with readable () function. If you hit a key, then readable()-1, otherwise readable ()-0 This can be accomplished with: if (pc. readable()-1) c=pc.getc ( ); // pc is a serial object ?COM35 . Tera Term VT File Edit Setup Control Window He ounter-8 counter-1 ounter-2 ounter 3 ounter-8 ounter-1 ounter 2 ounter-3 At this moment, the user has pressed on the 0-key #include "mbed.h" Busout leds (LED4, LED3, LED2, LEDI): Serial pc (USBTX, USBRX) int main(0 1. Add the code here... 2. Add snapshot for all outputs

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!