Page 144 - ARM Based Microcontroller Projects Using MBED
P. 144

130                       7. USING THE Mbed WITH SIMPLE PROJECTS


                                           case 8:
                                               Segments = 0x7F;
                                               break;
                                           case 9:
                                               Segments = 0x6F;
                                               break;
                                       }
                               }

                               //
                               // MAIN program
                               //
                               int main()
                               {
                                   int CNT = 0;

                                   while(1)                            // Do forever
                                   {
                                      Display(CNT);                    // Display CNT
                                      wait(1.0);                       // Wait 1 swcond
                                      CNT++;                           // Increment CNT
                                      if(CNT == 10)CNT = 0;            // Reset CNT
                                   }
                               }


                 FIG. 7.75,  CONT’D









                 FIG. 7.76  Block diagram of the project.


                      7.17 PROJECT 14—POWERING LARGE LOADS—DC MOTOR
                                                   CONTROL


                 7.17.1 Description
                   The current capacity of a GPIO pin is limited to 20mA. There are some applications however
                 where larger currents are needed then the port can supply, such as motors, relays, actuators,
                 etc. In this project, we shall see how a DC motor can be controlled from a GPIO pin of the
                 Nucleo-F411RE development board. This is a very simple project where a relay is used to ac-
                 tivate the motor for 10s, then the motor stops for 5s, and is then reactivated again for 20s.


                 7.17.2 Aim
                   The aim of this project is to show how loads requiring large currents can be connected to a
                 GPIO pin. Additionally, the project shows how a DC motor can be controlled from a relay.
   139   140   141   142   143   144   145   146   147   148   149