Go Down

### Topic: POV - Probleme mit Code (Read 863 times)previous topic - next topic

#### ICwiener

##### Jun 17, 2012, 11:36 am
Hallo zusammen,

ich habe mir ein kleines POV gebaut. Leider habe ich etwas Probleme bei der Erweiterung des Codes von Michael Zöllner.
Das Problem ist folgendes:
Ich habe zusätzlich einen Tiltsensor verbaut. Leider bekomme ich es nicht hin, dass die Buchstaben immer in eine Richtung angezeigt werden. Je nach dem, wo man beim "Schütteln" ist, werden die Buchstaben spiegelverkehrt angezeigt. Vielleicht könnt ihr mir ja helfen.
Danke euch.

Code: [Select]
`/*¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡persistence of vision typography with arduinomichael zoellner - march 2006http://i.document.m05.deconnect anodes (+) of 5 leds to digital ports of the arduino boardand put 20-50 ohm resistors from the cathode (-) to ground.the letters are lookup tables consisting arrays width the dot status in y rows.¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡*/// defining the alphabetint _[] = {0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0};int A[] = {0,1,1,1,1, 1,0,1,0,0, 0,1,1,1,1};int B[] = {1,1,1,1,1, 1,0,1,0,1, 0,1,0,1,0};int C[] = {0,1,1,1,0, 1,0,0,0,1, 1,0,0,0,1};int D[] = {1,1,1,1,1, 1,0,0,0,1, 0,1,1,1,0};int E[] = {1,1,1,1,1, 1,0,1,0,1, 1,0,1,0,1};int F[] = {1,1,1,1,1, 1,0,1,0,0, 1,0,1,0,0};int G[] = {0,1,1,1,0, 1,0,1,0,1, 0,0,1,1,0};int H[] = {1,1,1,1,1, 0,0,1,0,0, 1,1,1,1,1};int I[] = {0,0,0,0,1, 1,0,1,1,1, 0,0,0,0,1};int J[] = {1,0,0,0,0, 1,0,0,0,1, 1,1,1,1,1};int K[] = {1,1,1,1,1, 0,0,1,0,0, 0,1,0,1,1};int L[] = {1,1,1,1,1, 0,0,0,0,1, 0,0,0,0,1};int M[] = {1,1,1,1,1, 0,1,1,0,0, 0,1,1,1,1};int N[] = {1,1,1,1,1, 1,0,0,0,0, 0,1,1,1,1};int O[] = {0,1,1,1,0, 1,0,0,0,1, 0,1,1,1,0};int P[] = {1,1,1,1,1, 1,0,1,0,0, 0,1,0,0,0};int Q[] = {0,1,1,1,1, 1,0,0,1,1, 0,1,1,1,1};int R[] = {1,1,1,1,1, 1,0,1,0,0, 0,1,0,1,1};int S[] = {0,1,0,0,1, 1,0,1,0,1, 1,0,0,1,0};int T[] = {1,0,0,0,0, 1,1,1,1,1, 1,0,0,0,0};int U[] = {1,1,1,1,1, 0,0,0,0,1, 1,1,1,1,1};int V[] = {1,1,1,1,0, 0,0,0,0,1, 1,1,1,1,0};int W[] = {1,1,1,1,0, 0,0,1,1,0, 1,1,1,1,0};int X[] = {1,1,0,1,1, 0,0,1,0,0, 1,1,0,1,1};int Y[] = {1,1,0,0,0, 0,0,1,0,0, 1,1,1,1,1};int Z[] = {1,0,0,1,1, 1,0,1,0,1, 1,1,0,0,1};int letterSpace;int dotTime;int richtung = 0;void setup(){  // setting the ports of the leds to OUTPUT  pinMode(9, OUTPUT);  pinMode(10, OUTPUT);  pinMode(11, OUTPUT);  pinMode(12, OUTPUT);  pinMode(13, OUTPUT);  pinMode(2, INPUT);  // defining the space between the letters (ms)  letterSpace = 12;  // defining the time dots appear (ms)  dotTime = 6;  }void printLetter(int letter[]){  richtung = digitalRead(2);  if (richtung == HIGH) {  int y;    // printing the first y row of the letter  for (y=0; y<5; y++)  {    digitalWrite(y+9, letter[y]);  }  delay(dotTime);    // printing the second y row of the letter  for (y=0; y<5; y++)  {    digitalWrite(y+9, letter[y+5]);  }  delay(dotTime);    // printing the third y row of the letter  for (y=0; y<5; y++)  {    digitalWrite(y+9, letter[y+10]);  }  delay(dotTime);    // printing the sspace between the letters  for (y=0; y<5; y++)  {    digitalWrite(y+9, 0);  }  delay(letterSpace);} else {  int y;    // printing the first y row of the letter  for (y=0; y<5; y++)  {    digitalWrite(y+9, letter[y+10]);  }  delay(dotTime);    // printing the second y row of the letter  for (y=4; y>-1; y--)  {    digitalWrite(y+9, letter[y+5]);  }  delay(dotTime);    // printing the third y row of the letter  for (y=4; y>-1; y--)  {    digitalWrite(y+9, letter[y]);  }  delay(dotTime);    // printing the sspace between the letters  for (y=4; y>-1; y--)  {    digitalWrite(y+9, 0);  }  delay(letterSpace);}}void loop(){  // printing some letters  printLetter(_);  printLetter(_);  printLetter(Z);  printLetter(_);  printLetter(_);  printLetter(_);}`

Go Up