  */
 
 #include "Wire.h"
-#define IS31FL3730_DIGIT_4_I2C_ADDRESS 0x63 // each I2C has a unique bus address, the 4 digit IS31FL3730 display is 0x63
-#define IS31FL3730_DIGIT_6_I2C_ADDRESS 0x60 // each I2C has a unique bus address, the 6 digit IS31FL3730 display is 0x60
+// Each I2C has a unique bus address
+#define IS31FL3730_DIGIT_4_I2C_ADDRESS 0x63 // 4 digit IS31FL3730 display
+#define IS31FL3730_DIGIT_6_I2C_ADDRESS 0x60 // 6 digit IS31FL3730 display
 
 const byte IS31FL3730_Data_Registers = 0x01; // "Matrix 1 Data Register" index in the IS31FL3730
 // 8 bit value to define which segments are lit. 0 == off, 1 == on

// Works great for data, but stop after the matrix data is updated and then end the command.

const byte IS31FL3730_Update_Column_Register = 0x0C; // "Update Column Register" index in the IS31FL3730
// The data sent to the Data Registers will be stored in temporary registers. 
// A write operation of any 8-bit value to the Update Column Register is required to update 
// the Data Registers (01h~0Bh, 0Eh~18h)

const byte IS31FL3730_Lighting_Effect_Register = 0x0D; // "Lighting Effect Register" index in the IS31FL3730
// Bottom four bits control the Full Current Setting for Each Row Output 
//   0000: 40mA 
//   0001: 45mA 
//   0010: 50mA 
//   0011: 55mA 
//   0100: 60mA 
//   0101: 65mA 
//   0110: 70mA 
//   0111: 75mA 
//   1000: 5mA 
//   1001: 10mA 
//   1010: 15mA 
//   1011: 20mA 
//   1100: 25mA 
//   1100: 30mA 
//   1110: 35mA
//   1111: ???? - not documented!

const byte IS31FL3730_PWM_Register = 0x19; // "PWM Register" index in the IS31FL3730
// The PWM Register can modulate LED light with 128 different items.
// When the D7 set to “1”, the PWM is the 128 item. 
// When the D7 set to “0”, D6:D0 set the PWM from the 0 item to the 127 item.

const byte IS31FL3730_Reset_Register = 0xFF; // "Reset Register" index in the IS31FL3730
// Once user writes any 8-bit data to the Reset Register, IS31FL3730 will reset all registers to default value.
// On  initial power-up, the IS31FL3730 registers are reset to their default values for a blank display.

/*
 * Android Setup Function
 */
void setup() {
  Wire.begin();
  
  // Set the maximum display power for both displays
  setDisplayPowerMax(4);
  setDisplayPowerMax(6);


/*
 * Resets the display and sets the current to the maximum (5mA per segment)
 *
 * Parameters:
 * digits Selects the display to set the current, 4 = 4 digit display and all
 *        others = 6 digit display
 */
void resetDisplay(int digits)
{
  setupWireTransmission(digits);

  // Reset the lighting effects (dim, bright, etc.)
  // Send any value to reset the lighting (value ignored)
