your1click
Member level 3
Two 7 segment display using 4094 and artuino
Hi all,
I tried to use two display interface with 4094 and arduino, how to send data to 4094, I sent 0-9 and its going for both display so how to send separate data for one display only without changing another display value. bellow I have uploaded circuit image file.
Here is my code
I used two switch and I want to change value from sw to display one value and from sw1 to display two value
but now If i change value its changing both together. so please help me
Hi all,
I tried to use two display interface with 4094 and arduino, how to send data to 4094, I sent 0-9 and its going for both display so how to send separate data for one display only without changing another display value. bellow I have uploaded circuit image file.
Here is my code
#include <z7seg_led.h>
#include <SPI.h>
const int CE = 8;
const int OE = 9;
const int sw = 3;
const int sw2 =4;
z7seg_led display(OE, CE);
void setup() {
SPI.begin();
display.begin();
display.set_type(z7seg_led_74hc4094);
display.set_pattern("ABCDEFG."); //
pinMode (sw, INPUT);
pinMode (sw2, INPUT);
}
void loop()
{
int stateButton = digitalRead(sw);
if(stateButton == LOW) { //if is pressed
static int i = 0;
display.begin_transfer();
display.send_digit(i++);
display.end_transfer();
if (i >= 10) {
i = 0;
}
delay(250);
}
else
{
stateButton = digitalRead(sw2);
if (stateButton == LOW) {
static int p = 0;
display.begin_transfer();
display.send_digit(p++);
display.end_transfer();
if (p >=10) {
p = 0;
}
delay(250);
}
}
}
I used two switch and I want to change value from sw to display one value and from sw1 to display two value
but now If i change value its changing both together. so please help me