初接觸
用網頁來控制LED亮滅
請先下載Arduino的範例程式:
取出發佈相關程式:
// Humidity measurement
temperature = dht.getTempCelcius();
// Humidity measurement
humidity = dht.getHumidity();
// Light level measurement
float light_measurement = analogRead(light_sensor_pin);
light = (int)(light_measurement/4096*100);
int uvValue=analogRead(uv);
ultraviolet = (uvValue*100)/1023;
// Publish data
Particle.publish("temperature", String(temperature));// + " °C");
delay(t);
Particle.publish("humidity", String(humidity));// + "%");
delay(t);
Particle.publish("light", String(light));// + "%");
Particle.publish()可以將資訊送到物聯網伺服器,一般都採用名稱/內容值的表示方式,來進行資料的連結,"temperature" 是名稱, String(temperature)是內容值。
delay(t);
沒有留言:
張貼留言