glennedi
Published © GPL3+

Blink 2 lead bi-coloured LED

For those LED's a leg short of three.

BeginnerFull instructions provided7,921
Blink 2 lead bi-coloured LED

Things used in this project

Hardware components

2 lead bi coloured led
×1
Arduino UNO
Arduino UNO
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

blink_bi_led_schem_651ojXscSn.jpg

blink_bi_led_bb_UfKirjpyOe.jpg

Code

blink_bi_led.ino

C/C++
/*
Test to see if you can flash 2 lead bi led using 2 ports -> you can
*/

//the pins -> red and green indicate positive connection pin for that colour
const int pin_red=2;
const int pin_green=3;

void setup() {
pinMode(pin_red,OUTPUT);
pinMode(pin_green,OUTPUT);
}

void loop() {

  set_outputs_plus_ground(pin_red,pin_green);
delay(1000);
  set_outputs_plus_ground(pin_green,pin_red);   
delay(1000);

           }

//my_functions
void set_outputs_plus_ground(int pin_plus, int pin_ground)
{
  //set both pins low first so you don't have them pushing 5 volts into eachother
  digitalWrite(pin_plus,LOW);  
  digitalWrite(pin_ground,LOW);
  //set output pin as high
  digitalWrite(pin_plus,HIGH);  
  }           

Credits

glennedi

glennedi

5 projects • 23 followers

Comments