I'm not sure how to attach code so i hope i do it right, this is my first post. I am trying to write code to use a 7448 BCD to seven segment display decoder to use less pins when using a seven segment display and just to make things a little different. Also, I am having the display show a number between 0 and 9 to represent the voltage its letting through. I am getting an error with using a void function. i am new to arduino so i am sure i am doing something very wrong but i would like to learn from this mistake. please help...
void setup()
{
binaryA(0, 0, 0, 0)
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
int myInts[] = {num0, num1, num2, num3, num4, num5, num6, num7, num8, num9};
}
void loop()
{
int lightIn = analogRead(0);
lightIn = map(lightIn, 0, 1024, 0, 9);
myInts[lightIn];
}
void binaryA(out1, out2, out3, out4)
{
if (out1 = 1) //pin 7; A
{
digitalWrite(7, HIGH);
}
else
{
digitalWrite(7, LOW);
}
if (out2 = 1) //pin 10; B
{
digitalWrite(10, HIGH);
}
else
{
digitalWrite(10, LOW);
}
if (out3 = 1) //pin 9; C
{
digitalWrite(9, HIGH);
}
else
{
digitalWrite(9, LOW);
}
if (out4 = 1) //pin 8; D
{
digitalWrite(8, HIGH);
}
else
{
digitalWrite(8, LOW);
}
}
void num0()
{
binaryA(0, 0, 0, 0);
}
void num1()
{
binaryA(1, 0, 0, 0);
}
void num2()
{
binaryA(0, 1, 0, 0);
}
void num3()
{
binaryA(1, 1, 0, 0);
}
void num4()
{
binaryA(0, 0, 1, 0);
}
void num5()
{
binaryA(1, 0, 1, 0);
}
void num6()
{
binaryA(0, 1, 1, 0);
}
void num7()
{
binaryA(1, 1, 1, 0);
}
void num8()
{
binaryA(0, 0, 0, 1);
}
void num9()
{
binaryA(1, 0, 0, 1);
}
photoresistor_7seg.ino (1.24 KB)