74HC595 Nixie Driver

Dependencies:   mbed

main.cpp

Committer:
heroistired
Date:
2017-06-16
Revision:
0:b5bd2bc3c14d

File content as of revision 0:b5bd2bc3c14d:

#include "mbed.h"
#include "Nixie.h"

//数码管驱动示例

Nixie myNixie(PA_0,PA_1,PA_4); //声明数码管类 依次是 DIO SCK RCK 任意GPIO脚都可以
 
int pos = 0, num = 0;
bool WithDot = false;
int main() 
{
    while(1) 
    {
        wait(0.15);
        myNixie.NixieShow(num,pos,WithDot);//在数码管上显示数字 num 要显示的数字 pos 数字显示的位置 从左到右 0-7 WithDot 是否显示小数点
        num++;
        pos++;
        if(num == 10)
        {
            num = 0;
            if(WithDot)
                WithDot = false;
            else
                WithDot = true;
        }
        if(pos == 8)
            pos = 0;
    }
}