Codigo Arduino (tecnologia Pov)
Enviado por thegame01 • 2 de Diciembre de 2012 • 218 Palabras (1 Páginas) • 881 Visitas
#define NUM_ELEM(x) (sizeof (x) / sizeof (*(x)))
int msg[] = {//message is displayed char by char. within each char, each col is light up 1 by 1 to create the "POV"
}; //end of arr
int ground = 5; // all -ve end led connect to here
//connect to individual led +ve
int ledPin6 = 6;
int ledPin7 = 7;
int ledPin8 = 8;
int ledPin9 = 9;
int ledPin10 = 10;
int ledPin11 = 11;
int ledPin12 = 12;
int ledPin13 = 13;
//declare pin as output digi
int ledPinArray[8] = {6,7,8,9,10,11,12,13};
int columnDelay;
int sizeWord = 0;
//the main for arduino
void setup() {
// initialize the digital pin as an output:
for(int i = 0; i < 8; i++){
pinMode(ledPinArray[i],OUTPUT);
}
pinMode(ground, OUTPUT);
digitalWrite(ground, LOW);
columnDelay = 2.5; //displaying at 500hz, 2.5ms between each col in each word of the msg.
Serial.begin(9600);
Serial.print("Number of msg: ");
Serial.println(NUM_ELEM(msg));
delay(2000);
sizeWord = NUM_ELEM(msg);
}//end main
void testLED()
{
for(int i = 0; i < 8; i++){//turn on LED
digitalWrite(ledPinArray[i],HIGH);
}
delay(1000); // for a second
for(int i = 0; i < 8; i++){//turn off LED
digitalWrite(ledPinArray[i],LOW);
}
delay(1000); // for a second
}//end testLED
void loop(){// ardu's while(1)
printMsg(msg);
delay(5); //delay between each msg
}//end loop
//function to print msg
void printMsg(int wordVar[]) {//pass in the arr we dec above
int numRows = sizeWord/8;
//code here
} //end printmsg
...