Here is the code of one of the programms i tryed to make.
in this one it is printing pixels from the left top of the screen to the right.
I tryed to power the supply from the Serial portal and also the normal power input.
//dichiaro i pin RELATIVI ALLE VARIABILI PRECEDENTEMENTE DESCRITTE
//
int velocita_pin = 1;
int contatore = 0;
int pulisci = 0;
int decine = 0;
int unita;
int larghezza = 3;
int lunghezza = larghezza + 20;
int lunghezza_doppia = lunghezza * 2;
int larghezza_doppia = 20 + (larghezza * 2);
int lunghezza_massima = (lunghezza * 2) + (larghezza * larghezza);
void setup()
{
ConfigureLCD();
ClearScreen();
}
void loop()
{
if (contatore < 10)
{
if (contatore == 0)
{
zero(lunghezza_doppia + 2,20,1);
}
if (contatore == 1)
{
uno(lunghezza_doppia + 2,20,1);
}
if (contatore == 2)
{
due(lunghezza_doppia + 2,20,1);
}
if (contatore == 3)
{
tre(lunghezza_doppia + 2,20,1);
}
if (contatore == 4)
{
quattro(lunghezza_doppia + 2,20,1);
}
if (contatore == 5)
{
cinque(lunghezza_doppia + 2,20,1);
}
if (contatore == 6)
{
six(lunghezza_doppia + 2,20,1);
}
if (contatore == 7)
{
sette(lunghezza_doppia + 2,20,1);
}
if (contatore == 8)
{
otto(lunghezza_doppia + 2,20,1);
}
if (contatore == 9)
{
nove(lunghezza_doppia + 2,20,1);
}
}
else
{
decine = contatore /10;
unita = contatore -(decine * 10);
if (decine == 0)
{
zero(20,20,1);
}
if (decine == 1)
{
uno(20,20,1);
}
if (decine == 2)
{
due(20,20,1);
}
if (decine == 3)
{
tre(20,20,1);
}
if (decine == 4)
{
quattro(20,20,1);
}
if (decine == 5)
{
cinque(20,20,1);
}
if (decine == 6)
{
six(20,20,1);
}
if (decine == 7)
{
sette(20,20,1);
}
if (decine == 8)
{
otto(20,20,1);
}
if (decine == 9)
{
nove(20,20,1);
}
if (unita == 0)
{
zero(lunghezza_doppia + 2,20,1);
}
if (unita == 1)
{
uno(lunghezza_doppia + 2,20,1);
}
if (unita == 2)
{
due(lunghezza_doppia + 2,20,1);
}
if (unita == 3)
{
tre(lunghezza_doppia + 2,20,1);
}
if (unita == 4)
{
quattro(lunghezza_doppia + 2,20,1);
}
if (unita == 5)
{
cinque(lunghezza_doppia + 2,20,1);
}
if (unita == 6)
{
six(lunghezza_doppia + 2,20,1);
}
if (unita == 7)
{
sette(lunghezza_doppia + 2,20,1);
}
if (unita == 8)
{
otto(lunghezza_doppia + 2,20,1);
}
if (unita == 9)
{
nove(lunghezza_doppia + 2,20,1);
}
}
delay(500);
ClearScreen();
contatore = contatore + 1;
if(contatore == 100)
{
contatore = 0;
}
}
void DrawBox(int x1, int y1, int x2, int y2, boolean on) //DISEGNO UN QUADRILATERO!!
{
Serial.print(0x7C, BYTE);
Serial.print(0x0F, BYTE);
Serial.print(x1, BYTE);
Serial.print(y1, BYTE);
Serial.print(x2, BYTE);
Serial.print(y2, BYTE);
Serial.print(on, BYTE);
}
void zero(int x,int y,boolean on)
{
DrawBox(x+larghezza,y,x+lunghezza,y+larghezza,on);
DrawBox(x,y+larghezza,x+larghezza,y+lunghezza,on);
DrawBox(x,y+larghezza_doppia,x+larghezza,y+lunghezza_doppia,on);
DrawBox(x+larghezza,y+lunghezza_doppia,x+lunghezza,y+lunghezza_massima,on);
DrawBox(x+lunghezza,y+lunghezza_doppia,x+larghezza_doppia,y+larghezza_doppia,on);
DrawBox(x+lunghezza,y+lunghezza,x+larghezza_doppia,y+larghezza,on);
}
void uno(int x,int y,boolean on)
{
DrawBox(x+lunghezza,y+larghezza,x+larghezza_doppia,y+lunghezza,on);
DrawBox(x+lunghezza,y+larghezza_doppia,x+larghezza_doppia,y+lunghezza_doppia,on);
}
void due(int x,int y,boolean on)
{
DrawBox(x+larghezza,y,x+lunghezza,y+larghezza,on);
DrawBox(x,y+larghezza,x+larghezza,y+lunghezza,on);
DrawBox(x+larghezza,y+lunghezza_doppia,x+lunghezza,y+lunghezza_massima,on);
DrawBox(x+lunghezza,y+lunghezza_doppia,x+larghezza_doppia,y+larghezza_doppia,on);
DrawBox(x+larghezza,y+lunghezza,x+lunghezza,y+larghezza_doppia,on);
}
void tre(int x,int y,boolean on)
{
DrawBox(x+larghezza,y,x+lunghezza,y+larghezza,on);
DrawBox(x+larghezza,y+lunghezza_doppia,x+lunghezza,y+lunghezza_massima,on);
DrawBox(x+lunghezza,y+lunghezza_doppia,x+larghezza_doppia,y+larghezza_doppia,on);
DrawBox(x+lunghezza,y+lunghezza,x+larghezza_doppia,y+larghezza,on);
DrawBox(x+larghezza,y+lunghezza,x+lunghezza,y+larghezza_doppia,on);
}
void quattro(int x,int y,boolean on)
{
DrawBox(x,y+larghezza_doppia,x+larghezza,y+lunghezza_doppia,on);
DrawBox(x+lunghezza,y+lunghezza_doppia,x+larghezza_doppia,y+larghezza_doppia,on);
DrawBox(x+lunghezza,y+lunghezza,x+larghezza_doppia,y+larghezza,on);
DrawBox(x+larghezza,y+lunghezza,x+lunghezza,y+larghezza_doppia,on);
}
void cinque(int x,int y,boolean on)
{
DrawBox(x+larghezza,y,x+lunghezza,y+larghezza,on);
DrawBox(x,y+larghezza_doppia,x+larghezza,y+lunghezza_doppia,on);
DrawBox(x+larghezza,y+lunghezza_doppia,x+lunghezza,y+lunghezza_massima,on);
DrawBox(x+lunghezza,y+lunghezza,x+larghezza_doppia,y+larghezza,on);
DrawBox(x+larghezza,y+lunghezza,x+lunghezza,y+larghezza_doppia,on);
}
void six(int x,int y,boolean on)
{
DrawBox(x+larghezza,y,x+lunghezza,y+larghezza,on);
DrawBox(x,y+larghezza,x+larghezza,y+lunghezza,on);
DrawBox(x,y+larghezza_doppia,x+larghezza,y+lunghezza_doppia,on);
DrawBox(x+larghezza,y+lunghezza_doppia,x+lunghezza,y+lunghezza_massima,on);
DrawBox(x+lunghezza,y+lunghezza,x+larghezza_doppia,y+larghezza,on);
DrawBox(x+larghezza,y+lunghezza,x+lunghezza,y+larghezza_doppia,on);
}
void sette(int x,int y,boolean on)
{
DrawBox(x+larghezza,y+lunghezza_doppia,x+lunghezza,y+lunghezza_massima,on);
DrawBox(x+lunghezza,y+lunghezza_doppia,x+larghezza_doppia,y+larghezza_doppia,on);
DrawBox(x+lunghezza,y+lunghezza,x+larghezza_doppia,y+larghezza,on);
}
void otto(int x,int y,boolean on)
{
DrawBox(x+larghezza,y,x+lunghezza,y+larghezza,on);
DrawBox(x,y+larghezza,x+larghezza,y+lunghezza,on);
DrawBox(x,y+larghezza_doppia,x+larghezza,y+lunghezza_doppia,on);
DrawBox(x+larghezza,y+lunghezza_doppia,x+lunghezza,y+lunghezza_massima,on);
DrawBox(x+lunghezza,y+lunghezza_doppia,x+larghezza_doppia,y+larghezza_doppia,on);
DrawBox(x+lunghezza,y+lunghezza,x+larghezza_doppia,y+larghezza,on);
DrawBox(x+larghezza,y+lunghezza,x+lunghezza,y+larghezza_doppia,on);
}
void nove(int x,int y,boolean on)
{
DrawBox(x+larghezza,y,x+lunghezza,y+larghezza,on);
DrawBox(x,y+larghezza_doppia,x+larghezza,y+lunghezza_doppia,on);
DrawBox(x+larghezza,y+lunghezza_doppia,x+lunghezza,y+lunghezza_massima,on);
DrawBox(x+lunghezza,y+lunghezza_doppia,x+larghezza_doppia,y+larghezza_doppia,on);
DrawBox(x+lunghezza,y+lunghezza,x+larghezza_doppia,y+larghezza,on);
DrawBox(x+larghezza,y+lunghezza,x+lunghezza,y+larghezza_doppia,on);
}
void ConfigureLCD() //CONFIGURO LO SCHERMO
{
pinMode(1, OUTPUT);
Serial.begin(112500);
}
void ClearScreen() //RIPULISCO LO SCHERMO
{
Serial.print(0x7C, BYTE);
Serial.print(0x00, BYTE); // clear screen
}