Wim Huiskamp
/
mbed_SDA5708
Test code for SDA5708 LED matrix display
Diff: main.cpp
- Revision:
- 0:7163ac97bad9
- Child:
- 1:bffa08157551
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Sep 29 19:45:23 2014 +0000 @@ -0,0 +1,60 @@ + +#include "mbed.h" +#include "SDA5708.h" + +// mbed Interface Hardware definitions +DigitalOut myled1(LED1); +DigitalOut myled2(LED2); +DigitalOut myled3(LED3); +DigitalOut heartbeatLED(LED4); + +// Host PC Communication channels +Serial pc(USBTX, USBRX); + +// SPI Communication +SPI spi_led(p5, NC, p7); // MOSI, MISO, SCLK + +//Display +SDA5708 led(&spi_led, p8, p9); // SPI bus, CS pin, RST pin + +// Variables for Heartbeat and Status monitoring +Ticker heartbeat; +bool heartbeatflag=false; + +// Heartbeat monitor +void pulse() { + heartbeatLED = !heartbeatLED; +} + +void heartbeat_start() { + heartbeat.attach(&pulse, 0.5); + heartbeatflag = true; +} + +void heartbeat_stop() { + heartbeat.detach(); + heartbeatflag = false; +} + +int main() { + int cnt; + + heartbeat_start(); + + led.locate(0, 0); + +//led.printf("*=%6d", 123456); +// 12345678 + led.printf("Hi mbed "); + wait(2); + + cnt=0x20; + while(1) { + wait(0.5); + + led.putc(cnt); + cnt++; + if (cnt == 0x80) cnt=0x20; + } + +}