I need to add the function to my PGM that I can set a number such as "118.50" I want to use the rotory enc. to enter first the 118 then push the rotory shaft button then enter the 50 This will display on 7 seg. leds and also be sent to my Visual Basic pgm. Here is the Arduino code thus far. All works as is.
// Arduino digital pins used to light up
// corresponding segments on the LED display
// Ron Buchwald** BUCHTRONICS LLC
// REV 1- 1/23/2012 10:AM
//NEW ADDED 8/8/2012
#define ID0 4 //DATA 0 - 3
#define ID1 5
#define ID2 6
#define ID3 7
#define AD0 9 // ADDRESS 0- 2
#define AD1 10
#define AD2 11
#define WRITE 8
#define encoder0PinA 2
#define encoder0PinB 3
volatile unsigned int encoder0Pos = 0;
// Common anode;
// on when pin is low
// and off when pin is high
#define ON HIGH
#define OFF LOW
void icm7218c(int digit,int datum)
{ digitalWrite(AD0,1 & digit);
digitalWrite(AD1,1 & (digit >> 1));
digitalWrite(AD2,1 & (digit >> 2));
digitalWrite(ID0,1 & datum);
digitalWrite(ID1,1 & (datum >> 1));
digitalWrite(ID2,1 & (datum >> 2));
digitalWrite(ID3,1 & (datum >> 3));
digitalWrite(WRITE,HIGH);
delay(10);
digitalWrite(WRITE,LOW);
}
void numout(int n)
{ int pos = 4;
do
{ icm7218c(pos,n % 10);
n /= 10;
}
while (pos--);
}
void setup() {
pinMode(ID0, OUTPUT);
pinMode(ID1, OUTPUT);
pinMode(ID2, OUTPUT);
pinMode(ID3, OUTPUT);
pinMode(AD0, OUTPUT);
pinMode(AD1, OUTPUT);
pinMode(AD2, OUTPUT);
pinMode(WRITE,OUTPUT);
pinMode(encoder0PinA, INPUT);
digitalWrite(encoder0PinA, HIGH); // turn on pullup resistor
pinMode(encoder0PinB, INPUT);
digitalWrite(encoder0PinB, HIGH); // turn on pullup resistor
attachInterrupt(0, doEncoder, CHANGE); // encoder pin on interrupt 0 - pin 2
Serial.begin (9600);
Serial.println("start"); // a personal quirk
}
void loop() {
encoder0Pos = constrain(encoder0Pos, 11800, 13699);
numout(encoder0Pos);
}
void doEncoder() {
/* If pinA and pinB are both high or both low, it is spinning
* forward. If they're different, it's going backward.
* For more information on speeding up this process, see
* [Reference/PortManipulation], specifically the PIND register.
*/
if (digitalRead(encoder0PinA) == digitalRead(encoder0PinB)) {
encoder0Pos++;
} else {
encoder0Pos--;
}
Serial.println (encoder0Pos, DEC);
}
As you may see the number prints as 11850 I have hard wired the dec. point on the leds and the VB pgm does not need to see the "."
Also it would be rear cool if the 100s flash when being set and then the 10th. I have made a Radio comm panel for my flight simm.

Any suggestions welcome. Ron.