Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 00003 //Global objects 00004 BusOut binaryOutput(D5, D6, D7); 00005 00006 00007 //Main function 00008 int main() { 00009 00010 //Create a variable to hold the bit pattern 00011 unsigned int u; 00012 00013 while(1) { 00014 00015 u = 1; //Set initial value 0 00016 int count = 0; 00017 while (count++ < 3) { 00018 binaryOutput = u; //Write to LEDs 00019 u = u << 1; //Shift left 1 bit 00020 wait(0.25); //Wait 00021 } 00022 00023 //At this point, the output is binary 100 00024 //Change to 010 00025 binaryOutput = 2; //The missing yellow state 00026 wait(0.25); 00027 00028 //The sequence can now repeat 00029 } //end while(1) 00030 } //end main
Generated on Mon Aug 1 2022 23:10:05 by
1.7.2