Scaling readings from an Electron

I need help on getting Temperature readings from an electron to my phone.

I really don’t want to spend time learning code, so the Tinker App will do.
Coping code works, too.
My goal is to keep it simple.

Tinker gives out a number that must be scaled. I can’t seem to find any info about scaling the photon or electron output.

Considering that the stock Tinker firmware won’t allow you to scale, you’ll have to do some programming, somewhere.

This is the part that gives out the analogread in Tinker, so you can apply the scaling there:

/*******************************************************************************
 * Function Name  : tinkerAnalogRead
 * Description    : Reads the analog value of a pin
 * Input          : Pin
 * Output         : None.
 * Return         : Returns the analog value in INT type (0 to 4095)
                    Returns a negative number on failure
 *******************************************************************************/
int tinkerAnalogRead(String pin)
{
    //convert ASCII to integer
    int pinNumber = pin.charAt(1) - '0';
    //Sanity check to see if the pin numbers are within limits
    if (pinNumber < 0 || pinNumber > 7) return -1;

    if(pin.startsWith("D"))
    {
        return -3;
    }
    else if (pin.startsWith("A"))
    {
        return analogRead(pinNumber+10);
    }
#if Wiring_Cellular
    else if (pin.startsWith("B"))
    {
        if (pinNumber < 2 || pinNumber > 5) return -3;
        return analogRead(pinNumber+24);
    }
#endif
    return -2;
}

I suggest mine project by using an DHT22 as sensor and Blynk to read the data on a smartphone.
It should also works on an electron instead of photon.

Though it would probably work, Blynk isn’t the best solution for the Electron since it would use a considerably amount of data, quickly wasting the bundle. Just a thought.

1 Like