Adding ir remote and 7seg to a x9c104

Try this for the alternative function.

else if (IrReceiver.decodedIRData.command == 0x9) {
  // alternate full/half
  static bool comm0x9Toggle = false ;                        // set automatically only one at start of program execution
  if ( comm0x9Toggle == false ) pot.setPotMax(false);        // set pot wiper to full resistance
  else pot.setPot(49, false);                                // set pot wiper to about half way (between 0 and 99)
  comm0x9Toggle = ! comm0x9Toggle ;                          // invert comm0x9Toggle
}

For driving a seven segment display, see here folowing links and examples:

Note: you can't extract the current state from the X9C chip so you have to keep a counter of the pulses/commands sent to it to determine what you display.

1 Like