mbeduino with led dice shield

Dependencies:   mbed

Committer:
hsgw
Date:
Sun Mar 10 10:39:51 2013 +0000
Revision:
0:86132e31ac47
mbeduino with led dice shield sample.; ; sample for compare Arduino sketch and mbed program

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hsgw 0:86132e31ac47 1 #include "mbed.h"
hsgw 0:86132e31ac47 2
hsgw 0:86132e31ac47 3 int dice[7] = {0,8,65,73,85,93,119};
hsgw 0:86132e31ac47 4
hsgw 0:86132e31ac47 5 BusOut diceLeds(p29,p21,p30,p22,p23,p11,p12);
hsgw 0:86132e31ac47 6
hsgw 0:86132e31ac47 7 DigitalOut myled(LED1);
hsgw 0:86132e31ac47 8
hsgw 0:86132e31ac47 9 int main() {
hsgw 0:86132e31ac47 10 diceLeds = dice[5];
hsgw 0:86132e31ac47 11 while(1) {
hsgw 0:86132e31ac47 12 }
hsgw 0:86132e31ac47 13 }
hsgw 0:86132e31ac47 14
hsgw 0:86132e31ac47 15
hsgw 0:86132e31ac47 16 /*
hsgw 0:86132e31ac47 17 Arduino sketch example
hsgw 0:86132e31ac47 18
hsgw 0:86132e31ac47 19 const int firstLedPin = 2;
hsgw 0:86132e31ac47 20
hsgw 0:86132e31ac47 21 const int dice[7][7] = {
hsgw 0:86132e31ac47 22 {0,0,0,0,0,0,0},
hsgw 0:86132e31ac47 23 {0,0,0,1,0,0,0},
hsgw 0:86132e31ac47 24 {1,0,0,0,0,0,1},
hsgw 0:86132e31ac47 25 {1,0,0,1,0,0,1},
hsgw 0:86132e31ac47 26 {1,0,1,0,1,0,1},
hsgw 0:86132e31ac47 27 {1,0,1,1,1,0,1},
hsgw 0:86132e31ac47 28 {1,1,1,0,1,1,1}
hsgw 0:86132e31ac47 29 };
hsgw 0:86132e31ac47 30
hsgw 0:86132e31ac47 31 void setDice(int num){
hsgw 0:86132e31ac47 32 for(int i=0;i<7;i++){
hsgw 0:86132e31ac47 33 digitalWrite(firstLedPin+i,dice[num][i]);
hsgw 0:86132e31ac47 34 }
hsgw 0:86132e31ac47 35 }
hsgw 0:86132e31ac47 36
hsgw 0:86132e31ac47 37 void setup(){
hsgw 0:86132e31ac47 38 for(int i=0;i<7;i++){
hsgw 0:86132e31ac47 39 pinMode(firstLedPin+i, OUTPUT);
hsgw 0:86132e31ac47 40 }
hsgw 0:86132e31ac47 41 setDice(5);
hsgw 0:86132e31ac47 42 }
hsgw 0:86132e31ac47 43
hsgw 0:86132e31ac47 44 void loop(){}
hsgw 0:86132e31ac47 45
hsgw 0:86132e31ac47 46
hsgw 0:86132e31ac47 47
hsgw 0:86132e31ac47 48 */