ikeyasu / switchdevice-milkcarton-1

MIT License
0 stars 0 forks source link

Send accelerometer data when shaking #8

Closed ikeyasu closed 10 years ago

ikeyasu commented 10 years ago
ikeyasu commented 10 years ago

http://docs.spark.io/firmware/#spark-variable

// EXAMPLE USAGE
int analogvalue = 0;
double tempC = 0;
char *message = "my name is spark";

void setup()
{
  // variable name max length is 12 characters long
  Spark.variable("analogvalue", &analogvalue, INT);
  Spark.variable("temp", &tempC, DOUBLE);
  Spark.variable("mess", message, STRING);
  pinMode(A0, INPUT);
}

void loop()
{
  // Read the analog value of the sensor (TMP36)
  analogvalue = analogRead(A0);
  //Convert the reading into degree celcius
  tempC = (((analogvalue * 3.3)/4095) - 0.5) * 100;
  Delay(200);
}
ikeyasu commented 10 years ago

https://github.com/ikeyasu/switchdevice-milkcarton-1/commit/c89fa75b8ae432f2776c77b401766382f608dc19 is not enough.

ikeyasu commented 10 years ago

https://github.com/ikeyasu/switchdevice-milkcarton-1/commit/0733ff214ef0f149cd29750d2f0756becf6756e1 does not refer cloud variable to get conditions. It should be future work.