8×64 LED Display
This LED display allows you to send text from your mobile phone via Bluetooth. It’s ideal for placing in a shop window or displaying messages to drivers behind you in traffic.
Demo Video:
The Code:
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Max72xxPanel.h>int pinCS = 10; // Attach CS to this pin, DIN to MOSI and CLK to SCK (cf http://arduino.cc/en/Reference/SPI )
int numberOfHorizontalDisplays = 1;
int numberOfVerticalDisplays = 8;Max72xxPanel matrix = Max72xxPanel(pinCS, numberOfHorizontalDisplays, numberOfVerticalDisplays);
String tape = ” Dikkat “;
int wait = 70; // In millisecondsint spacer = 1;
int width = 5 + spacer; // The font width is 5 pixels
String serialResponse = “”;
char sz[] = ” “;void setup() {
matrix.setRotation(matrix.getRotation()+3); //1 – 90 2 – 180 3 – 270
matrix.setIntensity(15); // Use a value between 0 and 15 for brightness//Clear screen
matrix.fillScreen(LOW);
matrix.write();Serial.begin(9600);
}void loop() {
if ( Serial.available()) {
serialResponse = Serial.readStringUntil(‘\r\n’);if(serialResponse.length() > 1){
// Convert from String Object to String.
char buf[sizeof(sz)];
serialResponse.toCharArray(buf, sizeof(buf));
char *p = buf;
char *str;
while ((str = strtok_r(p, ” “, &p)) != NULL) // delimiter is the space
{
writeText(str, true);
delay(1000);
matrix.fillScreen(LOW);
matrix.write();
delay(400);
writeText(str, true);
delay(1000);
matrix.fillScreen(LOW);
matrix.write();
delay(400);
writeText(str, true);
delay(1000);
matrix.fillScreen(LOW);
matrix.write();
delay(500);
}
}
}
}void writeText(String str, bool center)
{
int x = 0;
if(center)
{
x = ((int)matrix.width() – (int)(str.length() * width)) / 2;
if(x < 0){
x = 0;
}
}
int y = (matrix.height() – 8) / 2; // center the text vertically
matrix.fillScreen(LOW);
int letter = 0;
while (letter < str.length()) {
matrix.drawChar(x, y, str[letter], HIGH, LOW, 1);letter++;
x += width;
}matrix.write(); // Send bitmap to display
}
———————————————–