Closed
Description
V 2.3.0
Arduino Uno / ESP-12F
While porting an sketch from Arduino it mysteriously crashed. I isolated the problem to the map() function when the arrays are empty. Once I fill it it works as it should.
The sketch is working without problems on Arduino Uno (returning -1 for each value) but uploaded to the ESP it crashes.
(Background: I need empty calibration data which will be filled later once sensors are read)
Minimal Sketch part to show it:
int FeuchtigkeitRAW[16] = {};
int FeuchtigkeitMAP[16] = {};
int FeuchtigkeitCALIB[32] = {};
void MapPots()
{
for (byte i = 0; i < 16; i++)
{
FeuchtigkeitMAP[i] = map(FeuchtigkeitRAW[i], FeuchtigkeitCALIB[i], FeuchtigkeitCALIB[i + 16], 0, 100);
}
}
void setup()
{
Serial.begin(115200);
}
void loop()
{
MapPots();
Serial.print("Wert ");
for (byte i = 0; i < 16; i++)
{
Serial.print(FeuchtigkeitMAP[i]);
Serial.print(" ");
}
Serial.print("\n");
delay(1000);
}