I am working with the NodeMCU ESP32. I have a coin sensor built from two copper plates that detect when a coin rolls down the chute. I am using the interrupt function to detect the coin. It works well with the Arduino Uno R3, but when connected to the NodeMCU ESP32, a simple calculation in my function results in the following error:
Code: Select all
Guru Meditation Error: Core 1 panic'ed (Coprocessor exception)
Code: Select all
Core 1 was running in ISR context
1) I set up the interrupt on GPIO 17:
Code: Select all
attachInterrupt( digitalPinToInterrupt(INPUT_PIN_COIN), Interrupt_CoinDeposit, FALLING );
Code: Select all
void IRAM_ATTR Interrupt_CoinDeposit()
{
g_crOSCore.EnqueueCoin();
}
Code: Select all
bool CCrowboxCore::EnqueueCoin()
{
//cros_time_t is a typedef of float
cros_time_t n = GetUptimeSeconds();
Serial.println(n);
cros_time_t m = m_uptimeLastCoinDetected;
Serial.println(m);
cros_time_t x = n - m;
Serial.println(x);
if (x < 1.0) {
return false;
}
m_numEnqueuedDeposits++;
m_uptimeLastCoinDetected = GetUptimeSeconds();
return true;
}
Code: Select all
GetUptimeSeconds();
Code: Select all
m_uptimeLastCoinDetected
My code runs into issues when I reach the
Code: Select all
x = n - m