Hello,
I'm using the code below to publish an event. I've done the integration (it was my first) and my message counter is increasing on my IoT hub. First question, where can I see the messages in Azure? Second question I use the Azure CLI monitor K:>az iot hub monitor-events -n [Hub name] i'm not getting any event logging.
#include "Particle.h"
SYSTEM_MODE(AUTOMATIC);
SYSTEM_THREAD(ENABLED);
SerialLogHandler logHandler(LOG_LEVEL_INFO);
#define RT0 10000
#define B 3947.57
#define R 9880
float RT;
float VR;
float ln;
float Tx;
float Tc;
float T0;
double Tf;
float VRT;
float Vin = A0;
unsigned long publishDelay = 60000;
unsigned long previousTimePub = 0;
void checkTemp(){
//Read the voltage across the thermistor
VRT = (3.3/4095) * analogRead(Vin);
//Calculate the voltage across the thermistor
VR = 3.3 - VRT;
//Calculate resistance of the thermistor
RT = VRT / (VR/R);
//Calculate temperature from thermistor resistance
ln = log(RT/RT0);
T0 = 25 + 273.15;
Tx = (1 / ((ln / B) + (1 / T0)));
//Convert to Celsius
Tc = Tx - 273.15;
//Convert and display in Fahrenheit
Tf = round(((Tc * 1.8) + 32)*10)/10;
}
void setup() {
Serial.begin(9600);
pinMode(Vin, INPUT);
Particle.variable("Temperaturef", Tf);
}
void loop() {
unsigned long timeNow = millis();
checkTemp();
Serial.print (Tf);
Serial.println ("F");
if (timeNow - previousTimePub > publishDelay){
checkTemp();
Particle.publish("Temperaturef", String(Tf, 1));
Log.info("previousTimePub...");
previousTimePub += publishDelay;
}
delay (500);
}```