Kamis, Juli 10, 2014

Operate Seven Segment Typed Anode Using Arduino

Seven segment display typed anode

Before should read ways to operation led using arduino here and introduction to seven segment display here.

Make schematic as follows:
  1. Connect pin 5V of arduino to pin Vcc of seven segment
  2. Connect pin a of seven segment to pin 13 of arduino using resistor

On segment a:
Upload arduino sketch follows:

int pin_a = 13;

void setup()
{
  pinMode(pin_a, OUTPUT);
}

void loop()
{
  digitalWrite(pin_a, LOW);
}


Make segment a blink:
Upload arduino sketch follows:

int pin_a=13;

void setup()
{
  pinMode(pin_a, OUTPUT);
}

void loop()
{
  digitalWrite(pin_a, LOW); //pin_a ON
  delay(1000); //wait for 1000ms
  digitalWrite(pin_a, HIGH); //pin_a OFF
  delay(1000); //wait for 1000ms
}


Add initial schematic by connecting pin b of seven segment to pin 12 of arduino using resistor

Make segment a and b blink:
Upload arduino sketch follows:

int pin_a=13, pin_b=12;

void setup()
{
  pinMode(pin_a, OUTPUT);
  pinMode(pin_b, OUTPUT);
}

void loop()
{
  digitalWrite(pin_a, LOW); //pin_a ON
  digitalWrite(pin_b, HIGH); //pin_b OFF
  delay(1000); //wait for 1000ms
  digitalWrite(pin_a, HIGH); //pin_a OFF
  digitalWrite(pin_b, LOW); //pin_b ON
  delay(1000); //wait for 1000ms
}



0 komentar: