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.
Diff: main.cpp
- Revision:
- 0:e45e376e31d3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Sep 29 11:53:43 2019 +0000 @@ -0,0 +1,54 @@ +#include "mbed.h" + +DigitalOut greenLed(LED1); +BusOut my7Seg(PA_8, PA_9, PA_10, PC_9, PC_8, PC_7, PC_6, PA_11); //8bit data + //LSB MSB + +int main(){ + my7Seg = 0xFF; + greenLed = 1; + + char temp7Seg; + + while (1) { + for (int n=0; n<10; n++) { + switch(n) { + case 0: + temp7Seg = ~0x3F; + break; + case 1: + temp7Seg = ~0x06; + break; + case 2: + temp7Seg = ~0x5B; + break; + case 3: + temp7Seg = ~0x4F; + break; + case 4: + temp7Seg = ~0x66; + break; + case 5: + temp7Seg = ~0x6D; + break; + case 6: + temp7Seg = ~0x7D; + break; + case 7: + temp7Seg = ~0x07; + break; + case 8: + temp7Seg = ~0x7F; + break; + case 9: + temp7Seg = ~0x6F; + break; + } + + greenLed = !greenLed; + my7Seg = (temp7Seg & 0x7F) | ((greenLed & 0x01) << 7 ); + + wait (0.5); + } + } +} \ No newline at end of file