#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space #include // Cayenne authentication info. This should be obtained from the Cayenne Dashboard. char username[] = "7ea929d0-5ef7-11ea-b301-fd142d6c1e6c"; char password[] = "53ba22eed9c14d67e5e3a8366bbfaa113481a31d"; char clientID[] = "193140a0-5ef8-11ea-b73d-1be39589c6b2"; #define VIRTUAL_CHANNEL 0 int val; int ACTUATOR_PIN = 2; void setup() { Serial.begin(9600); } void loop() { Cayenne.loop(); } // This function is called when data is sent from Cayenne. CAYENNE_IN(VIRTUAL_CHANNEL) { val = analogRead(ACTUATOR_PIN); float mv = ( val/1024.0)*5000; float cel = mv/10; CAYENNE_LOG("Channel %d, pin %d, value %d, VIRTUAL_CHANNEL, ACTUATOR_PIN, value); // Write the value received to the PWM pin. analogWrite accepts a value from 0 to 255. analogWrite(ACTUATOR_PIN, value); CAYENNE_OUT(VIRTUAL_CHANNEL) { Cayenne.virtualWrite(VIRTUAL_CHANNEL, analogRead(ACTUATOR_PIN), "analog_sensor" , "null"); } /* //This will write the temperature to the serial port Serial.print("TEMPRATURE = "); Serial.print(cel); Serial.print("*C"); Serial.println(); delay(1000); */ }