Sabtu, November 22, 2014

Operate Seven Segment Typed Cathode 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 a of seven segment to pin 13 of arduino using resistor
  2. Connect pin Gnd of arduino to pin Gnd of seven segment

On segment a:
Upload arduino sketch follows:

int pin_a = 13;

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

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


Make segment a blink:
Upload arduino sketch follows:

int pin_a=13;

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

void loop()
{
  digitalWrite(pin_a, HIGH); //pin_a ON
  delay(1000); //wait for 1000ms
  digitalWrite(pin_a, LOW); //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, HIGH); //pin_a ON
  digitalWrite(pin_b, LOW); //pin_b OFF
  delay(1000); //wait for 1000ms
  digitalWrite(pin_a, LOW); //pin_a OFF
  digitalWrite(pin_b, HIGH); //pin_b ON
  delay(1000); //wait for 1000ms
}



0 komentar: