Adding new connectors

This page explains how to edit the code to add more connectors to the sensor box.

If you want to add more connectors to the sensor box or just want to use i2c pin 7 and 8 on the multiplexer you need to uncomment the code in the sending_data switch in the prepareTxFrame function

//cases for two extra connectors 
    case 7: //sensor name / multiplexer 7
      for (uint8_t i = 0; i < 12; i++)
      {
        data[i] = data_array_6[i];
      }
      break;
    
    case 8: //sensor name / multiplexer pin 8
      for (uint8_t i = 0; i < 12; i++)
      {
        data[i] = data_array_7[i];
      }
      break;

Then you need to the main loop and change the if statement in the DEVICE_STATE_SEND case to 9.

case DEVICE_STATE_SEND:
      {
        if (packageNum == 0 )
        {
          get_sensor_data();
        }

        delay(500);
        prepareTxFrame(appPort, packageNum);
        LoRaWAN.send();
        packageNum++;
     -> if (packageNum == 7) //change this to 9 if you want to add two more connectors
        {
          packageNum = 0;
          //put to sleep here -- deepsleep/ sleep ? --> watchdog ?
        }
        deviceState = DEVICE_STATE_CYCLE;
        break;
      }

Last updated