Kode
- 1. #include <SPI.h> //SPI.h must be included as DMD is written by SPI (the
IDE complains otherwise)
#include <DMD.h> //
#include <TimerOne.h> //
#include "SystemFont5x7.h"
//Fire up the DMD library as dmd
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 1
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);
float a;
char b[5];
void ScanDMD()
{
dmd.scanDisplayBySPI();
}
void setup(void)
{
Timer1.initialize( 5000 );
Timer1.attachInterrupt( ScanDMD );
dmd.clearScreen( true );
Serial.begin(9600);
}
void loop(void)
{
dmd.clearScreen( true );
a = 0;
a = analogRead(A5);
a = (5.0*a*100.0)/1024.0;
Serial.println(a);
dtostrf(a, 4, 2, b);
dmd.selectFont(SystemFont5x7);
dmd.drawString( 2, 3, b, 5, GRAPHICS_NORMAL );
delay(5000);
}