Please help with array issues

I am developing a program to log and eventually store data and I am utilizing an array, but some of my data is not being stored. Specifically the current and volts are not being stored in the array, the max9611_addr is being stored in the array just fine. Any thoughts would be very helpful. Thank you.

#include <MAX9611.h>
#include <Wire.h>
/*
 Analog pins 4 (SDA),5(SCL)
 */
#include <Adafruit_MCP23017.h>
#include <Adafruit_RGBLCDShield.h>
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();

int msb;
int lsb;
int lcd_disp[16][3] = {
  0};
double volts;
double current;
byte max9611_addr;
int current_sense_gain;

void setup()
{
  lcd.begin(16, 2);
  Serial.begin(9600);
  delay(1); //wait for serial bus to settle
}

void loop()
{


  lcd.setCursor(0,1);
  while (1) {

    Wire.begin();
    for (max9611_addr = 0x70; max9611_addr <= 0x7F; max9611_addr++) //scan I2c bus for potential MAX9611 devices
    {
      Wire.beginTransmission (max9611_addr);
      if (Wire.endTransmission () == 0)
      {
        volts = get_MAX9611_voltage(max9611_addr);//get the voltage for this device the parameter is the address

        lcd.setCursor(3,1);
        lcd.print(volts, 2); //print the current with 2 decimal places
        lcd.print(" V");

        current_sense_gain = 1;

        current = get_MAX9611_current(max9611_addr, current_sense_gain); //get the current for this device (the first parameter is the address and the second{future} is the gain)
//        if(volts == 0)
//        {
//          current = 0;
//        }
        lcd.setCursor(3,0);
        lcd.print(current, 6); //print the current with 4 decimal places
        lcd.print(" A"); 

        lcd.setCursor(0,0);
        lcd.print(max9611_addr<<1,HEX); //print address

        switch (max9611_addr) {
        case 0x70:
          lcd_disp[0][0] = max9611_addr;
          lcd_disp[0][1] = current;
          lcd_disp[0][2] = volts;
          break;
        case 0x71:
          lcd_disp[1][0] = max9611_addr;
          lcd_disp[1][1] = current;
          lcd_disp[1][2] = volts;
          break;
        case 0x72:
          lcd_disp[2][0] = max9611_addr;
          lcd_disp[2][1] = current;
          lcd_disp[2][2] = volts;
          break;
        case 0x73:
          lcd_disp[3][0] = max9611_addr;
          lcd_disp[3][1] = current;
          lcd_disp[3][2] = volts;
          break;
        case 0x74:
          lcd_disp[4][0] = max9611_addr;
          lcd_disp[4][1] = current;
          lcd_disp[4][2] = volts;
          break;
        case 0x75:
          lcd_disp[5][0] = max9611_addr;
          lcd_disp[5][1] = current;
          lcd_disp[5][2] = volts;
          break;
        case 0x76:
          lcd_disp[6][0] = max9611_addr;
          lcd_disp[6][1] = current;
          lcd_disp[6][2] = volts;
          break;
        case 0x77:
          lcd_disp[7][0] = max9611_addr;
          lcd_disp[7][1] = current;
          lcd_disp[7][2] = volts;
          break;
        case 0x78:
          lcd_disp[8][0] = max9611_addr;
          lcd_disp[8][1] = current;
          lcd_disp[8][2] = volts;
          break;
        case 0x79:
          lcd_disp[9][0] = max9611_addr;
          lcd_disp[9][1] = current;
          lcd_disp[9][2] = volts;
          break;
        case 0x7A:
          lcd_disp[10][0] = max9611_addr;
          lcd_disp[10][1] = current;
          lcd_disp[10][2] = volts;
          break;
        case 0x7B:
          lcd_disp[11][0] = max9611_addr;
          lcd_disp[11][1] = current;
          lcd_disp[11][2] = volts;
          break;
        case 0x7C:
          lcd_disp[12][0] = max9611_addr;
          lcd_disp[12][1] = current;
          lcd_disp[12][2] = volts;
          break;
        case 0x7D:
          lcd_disp[13][0] = max9611_addr;
          lcd_disp[13][1] = current;
          lcd_disp[13][2] = volts;
          break;
        case 0x7E:
          lcd_disp[14][0] = max9611_addr;
          lcd_disp[14][1] = current;
          lcd_disp[14][2] = volts;
          break;
        case 0x7F:
          lcd_disp[15][0] = max9611_addr;
          lcd_disp[15][1] = current;
          lcd_disp[15][2] = volts;
          break;
        }
        Serial.print (lcd_disp[0][0]<<1,HEX);
        Serial.print ("  ");
        Serial.print (current = (float)lcd_disp[0][1],6);
        Serial.print ("  ");
        Serial.print (volts = (float)lcd_disp[0][2],2);
        Serial.print ("\n");
      }
    }
    delay (1);  // maybe unneeded?
  } // end of good response
} // end of for loop
/*********************************************************************
 * FileName: 		MAX9611.h
 * Dependencies: 	None
 * Overview:		Defines function prototypes, I2C address, global
 *					variables.
 ********************************************************************/


// ***************** User-configurable parameters ********************


// main voltage range
#define voltage_max 56.3
#define main_voltage_min 1.0

// main current range
#define current_max 10000
#define current_min 0

// I2C addresses
//From function The address comes from the function, which allows many different //address MAX9611 to be used

// Sense resistor values
#define sense_resistor 0.05

// *******************************************************************
// Function prototypes

double get_MAX9611_voltage(int address);
double get_MAX9611_current(int address, int gain);
/*********************************************************************
 * FileName: 		MAX9611.cpp
 * Dependencies: 	MAX9611.h (include here and in main)
 *				Wire.h (include here and in main)
 ********************************************************************/


/*********************************************************************
 * Function:        	void get_MAX9611_voltage (void),
 *				void get_MAX9611_current (void)
 * PreCondition:    	None.
 * Input:           	None.
 * Output:          	None.
 * Side Effects:    	None.
 * Overview:       		Function for obtaining MAX9611 voltage via I2C
 *						bus.
 *
 ********************************************************************/

#include "MAX9611.h"
#include "Wire.h"

double MAX9611_voltage;
double MAX9611_current;
int address;
int gain;
int result;

double get_MAX9611_voltage(int address){
int msb;
int lsb;
float multiplier = 0.014; //voltage sense LSB


    Wire.beginTransmission(address);
    Wire.write(0x0A);
    Wire.write(0x03);
    Wire.endTransmission();
    
    Wire.beginTransmission(address);
    Wire.write(0x02);
    Wire.endTransmission();

    Wire.requestFrom(address,2);
    msb = Wire.read();
    lsb = Wire.read();
    Wire.endTransmission();

MAX9611_voltage = ((msb)<<4)+(lsb>>4);
MAX9611_voltage = (MAX9611_voltage*multiplier);

return MAX9611_voltage;
}

double get_MAX9611_current(int address, int gain){
int msb;
int lsb;
float multiplier; //calculation multiplier
int reg_add; //register address

  switch (gain) {

    case 1: //gain of 1
	reg_add = 0x00;
	multiplier = 0.0001075;
     	break;

	case 4: //gain of 4
	reg_add = 0x01;
	multiplier = 0.00002688;
     	break;

    	case 8: //gain of 8
	reg_add = 0x02;
	multiplier = 0.00001344;
    	break;

    	default: //gain of 1
	reg_add = 0x00;
	multiplier = 0.0001075;
  }
    Wire.beginTransmission(address);
    Wire.write(0x0A);
    Wire.write(reg_add);
    Wire.endTransmission();
    
    Wire.beginTransmission(address);
    Wire.write(0x00);
    Wire.endTransmission();

    Wire.requestFrom(address,2);
    msb = Wire.read();
    lsb = Wire.read();
    Wire.endTransmission();

result = (msb<<4)+(lsb>>4);
MAX9611_current = ((result*multiplier)/0.05);

    	return MAX9611_current;
}
switch (max9611_addr) 
case 0x70:
          lcd_disp[0][0] = max9611_addr;
          lcd_disp[0][1] = current;
          lcd_disp[0][2] = volts;
          break;

it looks to me like your code could be vastly simplified/shortened by some simple arithmetic.

The code does not function without the {}

combib: The code does not function without the {}

That wasn't the point. That whole switch statement could have been replaced by a single assignment to lcd_disp[max9611_addr-0x70].

I don't much like the use of arrays to hold the result sets - I'd much rather see an array of structs. But aside from that I don't see anything that would stop your volts and current values being put at the appropriate place in each array. What makes you think they aren't being? If you're relying on that serial printout then that always shows lcd_disp[0] so tells you nothing about the other elements.

i am kind of new to this, but I think you are only specifying 1 voltage and 1 current with this:

int lcd_disp[16][3] = {0};
double volts;
double current;

I believe that you also have to create an array for volts and current. I think you also need to set up a loop to read and and store the variables. Something like this:

#define SENSORS 5 // number of sensors in loop
float degreesF[SENSORS];
byte Sensor[SENSORS][8]; // creates byte var. array called Sensor[from zero to #SENSORS][8 bytes long] 

void setup()
for (int i = 0; i < SENSORS; i++) 
    {
    degreesF[i] = sensors.getTempF(Sensor[i]);
}

Loop will also work to display results. It looks like you are reading the address and then using a switch to decide which results to display. Then incrementing the max9611 addr and starting over. I think the loop is more efficient unless you have something where you can pick a specific address

lcd.print(max9611_addr<<1,HEX); //print address
switch (max9611_addr) {
        case 0x70:
          lcd_disp[0][0] = max9611_addr;
          lcd_disp[0][1] = current;
          lcd_disp[0][2] = volts;
          break;
        case 0x71:
.........

Example of using an array of structures for your purpose.

#define ENTRIES(ARRAY)      (sizeof(ARRAY) / sizeof(ARRAY[0]))

struct record_t
{
    const byte  _addr;
    double      _volts;
    double      _current;
};

record_t    lcd_disp[] =
{
      { 0x70, 0.0, 0.0 }    //  0
    , { 0x71, 0.0, 0.0 }    //  1
    , { 0x72, 0.0, 0.0 }    //  2
    , { 0x73, 0.0, 0.0 }    //  3
    , { 0x74, 0.0, 0.0 }    //  4
    , { 0x75, 0.0, 0.0 }    //  5
    , { 0x76, 0.0, 0.0 }    //  6
    , { 0x77, 0.0, 0.0 }    //  7
    , { 0x78, 0.0, 0.0 }    //  8
    , { 0x79, 0.0, 0.0 }    //  9
    , { 0x7A, 0.0, 0.0 }    // 10
    , { 0x7B, 0.0, 0.0 }    // 11
    , { 0x7C, 0.0, 0.0 }    // 12
    , { 0x7D, 0.0, 0.0 }    // 13
    , { 0x7E, 0.0, 0.0 }    // 14
    , { 0x7F, 0.0, 0.0 }    // 15
};

for ( int i = 0; i < ENTRIES(lcd_disp); i++ )
{
    byte    addr            = lcd_disp[i]._addr;
    double  volts           = 'YOUR DERIVED VOLTAGE HERE';
    double  current         = 'YOUR DERIVED CURRENT HERE';

    // example of assigning something to an array entry

    lcd_disp[i]._volts      = volts;
    lcd_disp[i]._current    = current;

    // example of retrieving something from an array entry

    Serial.print(lcd_disp[i]._addr);
    Serial.print(lcd_disp[i]._volts);
    Serial.print(lcd_disp[i]._current);
}

stretched59,

int lcd_disp[16][3] = { 0 };

A feature of array initialization in C++ is that the last provided initializer will be propagated as an initializer for remaining unprovided entries of the array.

In the case an initializer for entry [0][0] is provided but will propagate to the remaining 47 entries.

You seem to be trying to save double values into an int array. This will probably work but not necessarily give you the outcome you expect.