Slide 14
Slide 14 text
14
プログラムは Ruby
System.exit "WA-MIKAN can't use." if(!System.use?("WiFi"))
System.exit "DS18B20 can't use." if(!System.use?('DS18B20'))
while true do
DS18B20.convert Add
delay wait
temp = DS18B20.read Add
if(Sw == SwOff && temp < Min && temp != -999)then
Sw = SwOn
Servo.write(0, Sw)
elsif(Sw == SwOn && temp > Max)then
Sw = SwOff
Servo.write(0, Sw)
end
tm = Rtc.getTime
if(tm[5] == 10)then
if(Sw == SwOn)then
body = '{"value1":"温度: ' + temp.to_s + ' ","value2":"
℃ スイッチ: ON","value3":""}'
else
body = '{"value1":"温度: ' + temp.to_s + ' ","value2":"
℃ スイッチ: OFF","value3":""}'
end
WiFi.httpPost(IFTTT, Header, body).to_s
end
led
end
最近はPythonも
走るようです