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

7.15 PROJECT 12—RANDOM COLORED LED DISPLAY            119





































            FIG. 7.62  Project constructed on a breadboard.

                           BEGIN
                                 Group RGB LED pins as a variable
                                 DO FOREVER
                                       Create a random number between 1 and 4
                                       Send the generated number to RGB LED
                                       Wait 250ms
                                 ENDDO
                           END
            FIG. 7.63  PDL of the program.


            endless loop is formed where a random number is generated between 1 and 4 and this num-
            ber is sent to the LED to display different colors every 250ms.



            7.15.8 Suggestions for Additional Work
              Modify the program given in Fig. 7.64 by randomly varying the delay between 50 and
            300ms. What are the effects of modifying this delay?
   128   129   130   131   132   133   134   135   136   137   138