Last active
January 8, 2018 01:57
-
-
Save tinoji/6bff1e24db24e03c683e3d9dd34f143c to your computer and use it in GitHub Desktop.
照明のスイッチをON/OFFするためのArduinoスケッチ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
pinMode(1, OUTPUT); | |
pinMode(9, OUTPUT); | |
pinMode(A0, INPUT); | |
Serial.begin(9600); | |
} | |
void loop() { | |
int inputValue = analogRead(A0); | |
// IFTTTからOutput Levelで分岐させる | |
if (inputValue >= 800) { | |
digitalWrite(1, HIGH); | |
} else if (inputValue > 400) { | |
digitalWrite(9, HIGH); | |
} | |
delay(500); | |
digitalWrite(1, LOW); | |
digitalWrite(9, LOW); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
littlebitsを使用(cloudbits+serve2個)。IFTTTからOutput Levelの違う2つの出力をー。