Thanks for the advice, and swift reply.
I've had excellent results with the hall effect assigned to socket 8B (GND & VOUT).
This means a interesting group of sensing options become possible with the reverse switch interrupt.
I've cut the smart cities code to it's bare components (I had GPRS and other functions attached).
I basically have a cycle of 10 seconds, printing temperature readings, and a interrupt set on the temperature of .72 (which by my aforementioned formula = 22 degrees C)
I've tested several times. the temperature readings appear very stable (rise & fall as anticipated)
I've ran the test with initial temperature (ambient) of 19 degrees C to 27.7 degrees C without generating an interrupt. I observed the temperature reach & exceed the threshold on several occasions in short.
Quote:
//SENSOR CITIES BOARD TEST
float value = 0;
float threshold_temp = 0.75;
void setup(){
USB.begin();
USB.println("USB port started...");
//Switch on the board
SensorCities.setBoardMode(SENS_ON);
delay(100);
//Init RTC
RTC.ON();
delay(100);
USB.println("RTC started...");
RTC.setTime("12:04:20:03:00:00:00");
SensorCities.setSensorMode(SENS_ON, SENS_CITIES_TEMPERATURE);
SensorEvent.setThreshold(SENS_CITIES_TEMPERATURE,threshold_temp);
delay(200);
value = SensorCities.readValue(SENS_CITIES_TEMPERATURE);
USB.print("value: ");
USB.println(value);
//sendSMS();
}
void loop(){
value = SensorCities.readValue(SENS_CITIES_TEMPERATURE);
USB.print("value: ");
USB.println(value);
SensorCities.attachInt();
//RTC.setAlarm1(0,0,0,10,RTC_ABSOLUTE,RTC_ALM1_MODE5); //every 10th second of every minute
RTC.setAlarm1(0,0,0,10,RTC_OFFSET,RTC_ALM1_MODE4); //every 10 seconds
USB.println("dropping off...");
PWR.sleep(UART0_OFF | UART1_OFF | BAT_OFF);
//PWR.sleep(UART0_OFF | BAT_OFF);
SensorCities.detachInt();
SensorCities.loadInt();
USB.begin();
USB.println("...waking up...");
if (SensorCities.intFlag & SENS_CITIES_TEMPERATURE)
{
SensorCities.intFlag &= ~(SENS_CITIES_TEMPERATURE);
USB.print("TEMPERATURE INTERRUPT\t");
value = SensorCities.readValue(SENS_CITIES_TEMPERATURE);
USB.print("value: ");
USB.println(value);
}
if( intFlag & RTC_INT ){
intFlag &= ~(RTC_INT); // Clear flag
USB.print("RTC INTERRUPT! ");
USB.print("Time is: ");
USB.println(RTC.getTime());
if(RTC.minute == 2)
{
USB.println("time to Report in....");
}
//value = SensorCities.readValue(SENS_CITIES_TEMPERATURE);
//USB.print("value: ");
//USB.println(value);
}
}
I think I am approaching the sensor board interruptions in the correct way, but I'd appreciate your help in debugging / rectifying this code. I have the board mounted and the sensor installed reliably, with responsive measurement of temperature changes.
Am I correct in saying the "SensorCities.attachInt();" will generate an interrupt from any cities sensor configured with a threshold / threshold & gain?