// This #include statement was automatically added by the Particle IDE. #include "ThingSpeak/ThingSpeak.h" #include // Change A1 to the specific analog pin you connected your potentiometer to. int sense=A1; float reading; float velocity=10; // If you are going to calibrate your sensor you should change these parameters to the ones you found. The formula used is y = a*x^2 + b*x + c float a=-0.00000056952223162858; float b=0.00091894447761036379; float c=0.06843175336954335200; TCPClient client; // Specify your own channelnumber and API key here. These are found at your Thingspeak Channel. unsigned long myChannelNumber = YourChannelID; const char * myWriteAPIKey = "YourAPIkeyHere"; void setup() { ThingSpeak.begin(client); } void loop() { reading=analogRead(sense); velocity=a*pow(reading,2)+b*reading+c; if (reading > 807) { velocity=0.4391; } // Write to ThingSpeak. There are up to 8 fields in a channel, allowing you to store up to 8 different // pieces of information in a channel. Here, we write to field 1. ThingSpeak.writeField(myChannelNumber, 1, velocity, myWriteAPIKey); delay(1000); }