Andar de bike é bom, mas com LEDs é melhor ainda. Bike POV é um dispositivo luminoso que faz desenhos na roda da bicicleta conforme ela gira. Ele é feito com um Arduino, 11 leds que podem ser de qualquer cor e um botão de controle para trocar os padrões desenhados.
Materias:
1 Arduino
11 LEDs
11 Resistores 12R
1 Resistor 10K
1 Pushbutton
1 Switch
28 Pins Header Macho
1 Bateria 9V
1 Soquete de bateria 9V
Ferramentas:
Ferro de solda
Alicate de corte
Circuito:
Segue o código do Arduino:
// defining the picts int off[] = { 0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0}; int heart[] = { 0,0,0,0,0,0,0,0,0,0,0, 0,0,1,1,1,1,0,0,0,0,0, 0,1,1,1,1,1,1,0,0,0,0, 0,1,1,1,1,1,1,1,0,0,0, 0,0,1,1,1,1,1,1,1,0,0, 0,0,0,1,1,1,1,1,1,1,0, 0,0,1,1,1,1,1,1,1,0,0, 0,1,1,1,1,1,1,1,0,0,0, 0,1,1,1,1,1,1,0,0,0,0, 0,0,1,1,1,1,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0}; int greek[] = { 1,1,0,0,0,0,0,0,0,0,0, 1,1,0,0,0,0,0,0,0,0,0, 1,1,0,0,1,1,1,1,1,1,0, 1,1,0,0,1,1,1,1,1,1,0, 1,1,0,0,1,1,0,0,1,1,0, 1,1,1,1,1,1,0,0,1,1,0, 1,1,1,1,1,1,0,0,1,1,0, 0,0,0,0,0,0,0,0,1,1,0, 0,0,0,0,0,0,0,0,1,1,0, 1,1,1,1,1,1,1,1,1,1,0, 1,1,1,1,1,1,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0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0}; int dotTime; // this constant won't change: const int buttonPin = 2; // the pin that the pushbutton is attached to // Variables will change: int buttonPushCounter = 0; // counter for the number of button presses int buttonState = 0; // current state of the button int lastButtonState = 0; // previous state of the button #include void setup() { // POV setting the ports of the leds to OUTPUT pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); pinMode(7, OUTPUT); pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(12, OUTPUT); pinMode(13, OUTPUT); // defining the time dots appear (ms) dotTime = 5; // initialize the button pin as a input: pinMode(buttonPin, INPUT); // initialize serial communication: Serial.begin(9600); } //POV void printPict(int row[]){ int y; // printing the y1 row of the pict for (y=0; y<11; y++) { digitalWrite(y+3, row[y]); } delay(dotTime); // printing the y2 row of the pict for (y=0; y<11; y++) { digitalWrite(y+3, row[y+11]); } delay(dotTime); // printing the y3 row of the pict for (y=0; y<11; y++) { digitalWrite(y+3, row[y+22]); } delay(dotTime); // printing the y4 row of the pict for (y=0; y<11; y++) { digitalWrite(y+3, row[y+33]); } delay(dotTime); // printing the y5 row of the pict for (y=0; y<11; y++) { digitalWrite(y+3, row[y+44]); } delay(dotTime); // printing the y6 row of the pict for (y=0; y<11; y++) { digitalWrite(y+3, row[y+55]); } delay(dotTime); // printing the y7 row of the pict for (y=0; y<11; y++) { digitalWrite(y+3, row[y+66]); } delay(dotTime); // printing the y8 row of the pict for (y=0; y<11; y++) { digitalWrite(y+3, row[y+77]); } delay(dotTime); // printing the y9 row of the pict for (y=0; y<11; y++) { digitalWrite(y+3, row[y+88]); } delay(dotTime); // printing the y10 row of the pict for (y=0; y<11; y++) { digitalWrite(y+3, row[y+99]); } delay(dotTime); // printing the y11 row of the pict for (y=0; y<11; y++) { digitalWrite(y+3, row[y+110]); } delay(dotTime); } void loop() { checkSerial(); printPict(lastPict); } int checkSerial () { //button loop // read the pushbutton input pin: buttonState = digitalRead(buttonPin); // compare the buttonState to its previous state if (buttonState != lastButtonState) { // if the state has changed, increment the counter if (buttonState == HIGH) { // if the current state is HIGH then the button // wend from off to on: buttonPushCounter++; Serial.println("on"); Serial.print("number of button pushes: "); Serial.println(buttonPushCounter, DEC); } else { // if the current state is LOW then the button // wend from on to off: Serial.println("off"); } } // save the current state as the last state, //for next time through the loop lastButtonState = buttonState; if(buttonPushCounter == 0) { memcpy(lastPict, off, sizeof(lastPict)); } if (buttonPushCounter == 1) { memcpy(lastPict, triangle, sizeof(lastPict)); } if (buttonPushCounter == 2) { memcpy(lastPict, diagonal, sizeof(lastPict)); } if (buttonPushCounter == 3) { memcpy(lastPict, seta, sizeof(lastPict)); } if (buttonPushCounter == 4) { memcpy(lastPict, greek, sizeof(lastPict)); } if (buttonPushCounter == 5) { memcpy(lastPict, chakana, sizeof(lastPict)); } if (buttonPushCounter > 5) { buttonPushCounter = 0; }
Circuito na placa perfurada
Neste circuito os componentes do Arduino foram soldados direto na placa perfurada, assim como o circuito complementar com os leds, resistores, botões e bateria.
Pode-se usar lacres plásticos ou arame para fixar a placa de leds no raio da bicicleta
Comments by Shankara