Navigation
Communication
Contact
comite@posttenebraslab.ch
+41 22 566 01 87
Lieu
Evénements
This is four sure0832 green LED matrices (8×32 pixels) concatenated, driven by a Teensy 2.0 http://www.pjrc.com/teensy board.
The Arduino source code is here: make sure to select Teensy 2.0 as your board before programming!
/*
Sure0832 sample application
Copyright 2010 Benjamin Sonntag <benjamin@sonntag.fr> http://benjamin.sonntag.fr/
History:
2010-03-20 - V1.0 Initial version, a little time after 26C3 :D
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <Arduino.h>
#include <inttypes.h>
#include "Sure0832.h"
#define X_MAX 31
#define Y_MAX 7
#define X_SIZE 32
#define Y_SIZE 8
sure0832 d1;
sure0832 d2;
sure0832 d3;
sure0832 d4;
void setup () // flow chart from page 17 of datasheet
{
d1.cs=4;
d1.data=7;
d1.wrclk=6;
d2.cs=2;
d2.data=7;
d2.wrclk=6;
d3.cs=1;
d3.data=7;
d3.wrclk=6;
d4.cs=3;
d4.data=7;
d4.wrclk=6;
sure0832_displayInit(&d1);
sure0832_displayInit(&d2);
sure0832_displayInit(&d3);
sure0832_displayInit(&d4);
}
void octopuce();
int readstringfromserial();
#define intensity 15
void loop ()
{
sure0832_sendcmd(&d1, SURE0832_CMD_PWM + intensity);
sure0832_sendcmd(&d2, SURE0832_CMD_PWM + intensity);
sure0832_sendcmd(&d3, SURE0832_CMD_PWM + intensity);
sure0832_sendcmd(&d4, SURE0832_CMD_PWM + intensity);
delay(SURE0832_DISPDELAY);
sure0832_clearScreen(&d1);
sure0832_clearScreen(&d2);
sure0832_clearScreen(&d3);
sure0832_clearScreen(&d4);
delay(SURE0832_DISPDELAY);
// octopuce();
scrolltext();
}
const char sentence1[512]=" Bienvenue au Post Tenebras Labs, le premiere Hackerspace ici a Geneve. Que voulez-vous faire aujourd'hui? ";
uint8_t sentencepos2=0;
int incomingByte = 0;
#define DELAY_FONT 10
void scrolltext() {
byte i;
int size1,curp=0,curx=32,p=0,x=0;
int strilen;
strilen=strlen((char*)sentence1);
while (curp<strilen) { // && !readstringfromserial()) {
p=curp;
curx--;
x=curx;
size1=Font_Draw(&d1, sentence1[p],x,0);
x+=size1;
if (x<=0) {
curx=x;
curp++;
}
p++;
// 1st Panel :
while (x<=X_MAX && p<strilen) {
x+=Font_Draw(&d1, sentence1[p],x,0);
p++;
}
x-=X_MAX+1;
p--;
x-=Font_Draw(&d2, sentence1[p],-9,0);
while (x<=X_MAX && p<strilen) {
x+=Font_Draw(&d2, sentence1[p],x,0);
p++;
}
x-=X_MAX+1;
if (p==strilen) {
delay(DELAY_FONT);
} else {
p--;
x-=Font_Draw(&d3, sentence1[p],-9,0);
while (x<=X_MAX && p<strilen) {
x+=Font_Draw(&d3, sentence1[p],x,0);
p++;
}
x-=X_MAX+1;
}
if (p==strilen) {
delay(DELAY_FONT);
} else {
p--;
x-=Font_Draw(&d4, sentence1[p],-9,0);
while (x<=X_MAX && p<strilen) {
x+=Font_Draw(&d4, sentence1[p],x,0);
p++;
}
x-=X_MAX+1;
}
if (p==strilen) {
delay(DELAY_FONT);
}
else
delay(DELAY_FONT); // added by Paul to slow it a bit
// delay(SURE0832_DISPDELAY/3);
}
sure0832_clearScreen(&d1);
sure0832_clearScreen(&d2);
sure0832_clearScreen(&d3);
sure0832_clearScreen(&d4);
delay(SURE0832_DISPDELAY);
delay(SURE0832_DISPDELAY);
}
/*
const char octopuc1[70]="31 Mai 2010, Octopuce et UnMillieme inaugurent le led panel 7x.";
void octopuce() {
int y,x,i;
for(y=-6;y<=7;y++) {
x=0;
for(i=0;i<9;i++) {
Font_Draw(&d1, octopuc1[i],x,y);
Font_Draw(&d2, octopuc2[i],x,y);
Font_Draw(&d3, octopuc3[i],x,y);
Font_Draw(&d4, octopuc4[i],x,y);
Font_Draw(&d5, octopuc5[i],x,y);
Font_Draw(&d6, octopuc6[i],x,y);
x=x+Font_Draw(&d7, octopuc7[i],x,y);
}
delay(3*SURE0832_DISPDELAY);
if (y==0) delay(6*SURE0832_DISPDELAY);
}
sure0832_clearScreen(&d1);
sure0832_clearScreen(&d2);
sure0832_clearScreen(&d3);
sure0832_clearScreen(&d4);
sure0832_clearScreen(&d5);
sure0832_clearScreen(&d6);
sure0832_clearScreen(&d7);
delay(SURE0832_DISPDELAY);
}
*/
If you tweak the source, please leave a note on the display in the hackerspace…