Hello,
I am finally starting to code photon for a smart device project. At this moment, I have flashed this onto the device
//Define the pins we're going to use as input
double sensor = 0; // WKP
double noise = 0;
double maxAmps = 0;
double minAmps =0;
double lastAmps = 0;
String astring;
void setup(){
Particle.variable("sensor",sensor);
Particle.variable("noise",noise);
pinMode(A7, INPUT);
}
void loop(){
// Read the analog value of the sensor (TMP36)
sensor = ((2960 - analogRead(A7))*45.4545/4095); //analog current reading in Amps
sensor = 0.5*(sensor + lastAmps); //average of last value and current value to smooth graph out
lastAmps = sensor;
//Averaging to distinguish from capacitor noise - Check data sheet for acs712 Hammad and manan to fix it
maxAmps = max(maxAmps, sensor);
minAmps = min(minAmps, sensor);
noise = maxAmps - minAmps; //capacitor filter noise calculation
if (analogRead(A7)!=-1) {maxAmps = sensor; minAmps = sensor;}
delay(200);
}
So after I flash this, I go on my cmd and type 'particle monitor 12345asdasasdhja12211212’
which asks me which variable I wanted. So far it looks like the datas are somehow going to the cloud. However, how do I fetch the data so I can display it or control it via an app?
I have tried the get function as it advised on reference/api webpage but this is what i get
C:\Users\PROJECT>particle get /v1/devices/12345asdasdasdhja12211212
polling server to see what devices are online, and what variables are available
Error { [Error: connect ETIMEDOUT 52.72.190.90:443]
code: 'ETIMEDOUT',
errno: 'ETIMEDOUT',
syscall: 'connect',
address: '52.72.190.90',
port: 443 }