José Luis Solé León
Published © GPL3+

Car Blinker

Blink for Vehicles, such as bikes and skates. Easy.

EasyProtip1 hour659
Car Blinker

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
LED (generic)
LED (generic)
Yellow
×3
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×3
Resistor 221 ohm
Resistor 221 ohm
Tip: 220 Ohm
×1
Resistor 1k ohm
Resistor 1k ohm
×3
Cable Ties (10 Pack)
OpenBuilds Cable Ties (10 Pack)
All is needed.
×1
9V battery (generic)
9V battery (generic)
Or another Power supply from 6v to 12v.
×1
USB-A to B Cable
USB-A to B Cable
Or USB-A to Mini-USB
×1
SparkFun Snappable Protoboard
SparkFun Snappable Protoboard
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

pliers
Screwdriver
Computer

Schematics

Circuit

Img 20170412 203124 dlamnc4qyq

Code

Blink

Arduino
/***   Included libraries  ***/


/***   Global variables and function definition  ***/
const int led_i = 12;
const int led_d = 11;
const int boton_i = 7;
const int boton_d = 6;
const int boton_emg = 8;
float encendido = 333;
float apagado = 666;
float bucle = 0;

/***   Setup  ***/
void setup() {
    pinMode(led_i, OUTPUT);
    pinMode(led_d, OUTPUT);
    pinMode(boton_i, INPUT);
    pinMode(boton_d, INPUT);
    pinMode(boton_emg, INPUT);
    digitalWrite(led_i, HIGH);
    digitalWrite(led_d, HIGH);
    delay(1000);
    digitalWrite(led_i, LOW);
    digitalWrite(led_d, LOW);
}

/***   Loop  ***/
void loop() {
    bucle = 0;
    if (digitalRead(boton_i) == true) {
        for (bucle = 0; bucle <= 10; bucle += 1) {
            digitalWrite(led_i, HIGH);
            delay(encendido);
            digitalWrite(led_i, LOW);
            delay(apagado);
        }
    }
    if (digitalRead(boton_d) == true) {
        for (bucle = 0; bucle <= 10; bucle += 1) {
            digitalWrite(led_d, HIGH);
            delay(encendido);
            digitalWrite(led_d, LOW);
            delay(apagado);
        }
    }
    while (digitalRead(boton_emg) == true) {
        digitalWrite(led_d, HIGH);
        digitalWrite(led_i, HIGH);
        delay(encendido);
        digitalWrite(led_d, LOW);
        digitalWrite(led_i, LOW);
        delay(apagado);
    }
}

Credits

José Luis Solé León

José Luis Solé León

2 projects • 0 followers
Contact

Comments