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
Fork of BusOut_HelloWorld by
Revision 4:c01479bfd551, committed 2014-10-16
- Comitter:
- shiyilei
- Date:
- Thu Oct 16 07:47:01 2014 +0000
- Parent:
- 3:b83cb0af21b0
- Commit message:
- The program uses the BusOut Class to make a counter
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Oct 16 07:42:24 2014 +0000
+++ b/main.cpp Thu Oct 16 07:47:01 2014 +0000
@@ -1,33 +1,20 @@
-/*************************************************
-*file name : switch point
-*creator:Jacob Shi
-*Time:2014/10/16
-*Description: uses to key to control the counter
-*************************************************/
+
+/***********************************************
+*file name :number show
+*creator: Jacob Shi
+*Time :2014/10/16
+*Description: The program use the BusOut Class to
+*realize a counter(0-9)
+ *************************************************/
#include "mbed.h"
char data[10]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};
-char i=0;
-BusInOut key(p5);
-BusInOut portnum(p21,p22,p23,p24,p25,p26,p27,p28);
-int main()
- {
- key.input();
- portnum.output();
- while(1)
- {
+BusOut port(p21, p22, p23, p24,p25,p26,p27,p28);
- portnum=0x00;
- if(key==0)
- {
- wait_ms(10);
- if(key==0)
- {
- while(!key);
- portnum=data[i];
- (i++)%10;
- }
-
- }
-
+int main() {
+ while(1) {
+ for(int i=0; i<10; i++) {
+ port = data[i];
+ wait(1);
}
- }
\ No newline at end of file
+ }
+}
\ No newline at end of file
