TaChing Yu / Mbed 2 deprecated 74HC595

Dependencies:   mbed

main.cpp

Committer:
yu10078999
Date:
2016-09-02
Revision:
0:e512ee8d297b
Child:
1:6f02ee58c5d6

File content as of revision 0:e512ee8d297b:

#include "mbed.h"

DigitalOut datapin(D8);    
DigitalOut latchpin(D9);   
DigitalOut clockpin(D10);
DigitalOut xx(D11);

int main() {
const int number[10][7]= {
  { 0, 0, 0, 0, 1, 1, 0}, // 1
  { 1, 0, 1, 1, 0, 1, 1}, // 2
  { 1, 0, 0, 1, 1, 1, 1}, // 3
  { 1, 1, 0, 0, 1, 1, 0}, // 4
  { 1, 1, 0, 1, 1, 0, 1}, // 5
  { 1, 1, 1, 1, 1, 0, 0}, // 6
  { 0, 0, 0, 0, 1, 1, 1}, // 7
  { 1, 1, 1, 1, 1, 1, 1}, // 8
  { 1, 1, 0, 0, 1, 1, 1}, // 9
  { 0, 1, 1, 1, 1, 1, 1}  // 0
};
    while(1) 
    {
        for(int j=0;j<=9;j++)
        {  
        latchpin=0;   
            for(int i=0;i<=7;i++)
            {
            wait(0.125);
            datapin=number[j][i];
            clockpin=1;
            clockpin=0;
            }
        latchpin=1;
        }        
        
    }
}