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.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:1690fdfbb3c5
- Child:
- 1:fdf5e90de5d0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Jun 05 08:19:44 2017 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+BusOut Seg1(PC_9,PC_8,PB_8,PC_6,PB_9,PC_5,PA_5,PA_12);// A,B,C,D,E,F,G,DP
+char SegConvert(char SegValue); // functionprototype
+int main() { // main program
+ while (1)
+ { // infinite loop
+ for (int i=9;i>-1;i--)
+ {
+ Seg1=SegConvert(i); //function call
+ wait(0.2);
+ }
+ }
+}
+
+char SegConvert(char SegValue) { // function 'SegConvert'
+char SegByte=0x00;
+switch (SegValue) { //DPGFEDCBA
+case 0 : SegByte = 0x3F;break; // 00111111 binary
+case 1 : SegByte = 0x06;break; // 00000110 binary
+case 2 : SegByte = 0x5B;break; // 01011011 binary
+case 3 : SegByte = 0x4F;break; // 01001111 binary
+case 4 : SegByte = 0x66;break; // 01100110 binary
+case 5 : SegByte = 0x6D;break; // 01101101 binary
+case 6 : SegByte = 0x7D;break; // 01111101 binary
+case 7 : SegByte = 0x07;break; // 00000111 binary
+case 8 : SegByte = 0x7F;break; // 01111111 binary
+case 9 : SegByte = 0x6F;break; // 01101111 binary
+ }
+ return SegByte;
+
+}
\ No newline at end of file