Hello forum,
I have a Pro mini 5v/16Mhz which I hooked up to a SIM808 GSM modem as data logger. I use Minicore for my Pro mini's. This board is one of three connected by I2C which makes up a complete system that switches water valves. One of the boards sends voltage and pressure data by I2C to this Pro mini which compiles this received data and uploads it to my server.
In setup I have this to trigger receiveWire() whenever data comes in.
Wire.begin(2);
Wire.onReceive(receiveWire);
receiveWire() inserts the received data into char array RX. Then I extract the data from RX to get the numerical value and convert it to float, which I need for the rest of the sketch.
if (RX[0] == 'V' && RX[3] == '=' && RX[strlen(RX) - 1] == '!') // V25=0.00! - format of received data
{
char nodeIncrCH[3];
nodeIncrCH[0] = RX[2];
nodeIncrCH[1] = RX[3];
nodeIncrCH[2] = '\0';
nodeIncr = atoi(nodeIncrCH);
int y = 0;
volatile char tempCh[5];
while (RX[y + 4] != '!')
{
tempCh[y] = RX[y + 4];
tempCh[y + 1] = '\0';
y++;
}
volatile float tempFl = atof(tempCh);
noInterrupts();
volts[nodeIncr] = tempFl;
interrupts();
}
The float array is defined as global variable.
float volts[30];
The issue I'm facing is that the compiler throws this error when I try to convert the volatile char array to volatile float. When I compile the same code for an Uno or Mega2560 there is no error or warning even, so I'm guessing the code could work?
invalid conversion from 'volatile char*' to 'const char*' [-fpermissive]
Is my code bad or is there a way to allow this warning to go through for Minicore boards?