PDA

View Full Version : Simple question, please help!



samfranklin
12-30-2013, 07:44 PM
Hello,

This is probably really simple so, I apologise in advance!

I have this code, which is working fine and I am confident that I can easily expand it to all the input switches I need:

int val = 0;int inputPin = 2;
int valOld = 0;
int val2 = 0;
int inputPin2 = 3;
int valOld2 = 0;


void setup()
{
pinMode(inputPin, INPUT);
pinMode(inputPin2, INPUT);
Serial.begin(115200);
digitalWrite(inputPin, HIGH);
digitalWrite(inputPin2, HIGH);
}


void loop() {
val = digitalRead(inputPin);


if (val == valOld) {
}
else {
if (val == HIGH) {
Serial.println("C02");
}
else {
Serial.println("C01");
};
valOld = val;
}
val2 = digitalRead(inputPin2);


if (val2 == valOld2) {
}
else {
if (val2 == HIGH) {
Serial.println("2 is high");
}
else {
Serial.println("2 is low");
};
valOld2 = val2;
}
delay(500);
}






My question is how can I extract information (in this same program) and output it to a 4 digit display for COM1 for example?!

Sam

BuzziBi
12-31-2013, 08:03 AM
I think you'll find everything you need in this thread!

http://www.mycockpit.org/forums/images/icons/icon3.png NEW COM RADIO CODE FOR 7 SEGMENT_DIODE REQUEST! (BRAINSTORMING) (http://www.mycockpit.org/forums/showthread.php?t=26959)

Fess_ter
01-11-2014, 02:46 AM
Or do like I did and use a MAX7219 module to drive the display.

7 segment led displays and my Radio Box (http://www.mycockpit.org/forums/showthread.php?t=27048)