Chen Huan
/
NiXie
74HC595 Nixie Driver
Diff: main.cpp
- Revision:
- 0:b5bd2bc3c14d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jun 16 07:07:15 2017 +0000 @@ -0,0 +1,29 @@ +#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; + } +}