I do see some issues - or things not clear to me.
First the less important.
Particle.variable("lastReading", &lastReading, INT);
This is the old way of writing this, which is now deprecated.
Rather write it this way now
But here is the bit that puzzles me.
Why do you set the pin you want to read your value from as OUTPUT and drive it at 3.3V?
Actually when you want to
analogRead() the pin, you shallnot set
pinMode() at all.
analogRead() will internally set a not commonly used
pinMode(AN_INPUT) and - if there was some other mode set before - re-set that mode when the reading is done. This will consume extra time and possibly also impact the signal source.
And another reminder of the point I stated earlier - you need to make sure your sensor never provides more than 3.3V to the pin when in
analogRead() mode otherwise you can say bye-bye to your ADC and if you exceed 5V even to the entire GPIO stage of that pin.