I’m working with my photon and a potentiometer. And I managed to measure the voltage and publish it online, but I want to do something with the measured voltage. For example, I want a formula like (voltage*0,01 =) and I’ve already searched on docs.particle.io, but I can’t find it.
Can someone help me out? Thanks in advance,
This is my code for now
const String topic = "Potentio";
//this enables Serial communication. When TRUE the Spark will send the measurement value over
//the USB serial every "intervalSerial" seconds. Only change to FALSE when no further debugging
#define DEBUG_SERIAL TRUE
//Sensor is connected to this pin.
const int inPin = A0;
//number of seconds between uploads to the Spark Cloud. This may never be lower than 60
//because IFTTT does not allow for more triggers than 1 per minute.
const int intervalOnline = 5;
//number of seconds between uploads over the USB serial
const int intervalSerial = 1;
//number of milliseconds between measurements. This could be as low as needed, but higher values
//results in a more stable behaviour of the ADC.
const int intervalMeasurement = 100;
//start Serial communication
if (DEBUG_SERIAL) Serial.begin(9600);
//set the inPin to INPUT
//every intervalMeasurement milliseconds, do a measurement
measurement = analogRead(inPin);
//every intervalSerial seconds, send measurement over Serial USB
//every intervalOnline seconds, publish measurement to Spark Cloud
String measurementText = String(measurement, DEC);