This is probably a very easy question for someone out there but It has me stumped. I have a three digit number like 123 or 286 etc. I am sending it from a Mega to NRF24l01+. This is working fine.
I am receiving the number fine with another NRF24l01+ and a Nano. now the problem. I have a 3 digit, 7 segment display. It is also working fine when using this code for a test..
[code]
/*Select a seven segment digit () in sequence.
* load a value into display for testing
*/
int i ;
byte j = B0000 ; //the digit value (0 to 9)
void setup()
{
DDRC = DDRC | B00111111; // set PORT C (digital 5~0) to outputs
pinMode(6, OUTPUT); // digit select pins (Latch signal)
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
Serial.begin(9600);
}
void loop() {
for (i = 6; i <9 ; i++) //digit select latch
{
digitalWrite(i, HIGH); // open latch
delay(100);
for (j = 0; j <10 ; j++) // test values for the display
{
PORTC = j; // write HEX value to digit
// Serial.print( PORTD ) ; // just for testing
// Serial.print( PORTC ) ; // just for testing
delay(100); //
}
delay(500); // wait a bit to read digit
digitalWrite(i, LOW); // close latch
delay(1000);
Serial.println( byte(i)) ; //only for testing
}
if(i == 9, i=6); //reset digit counter and do it again
}
[/code]
when I run the above code each digit counts up the latches then the next digit counts up. At he end.all is reset and repeats.
My problem is I can't isolate each of the received digits to individually load them into the display. Is there a way to separate the received number into digits so I can load the port? I hope this makes sense.
I can supply the schematic, video, etc. if it would help.
Bill