Skip to content

Instantly share code, notes, and snippets.

@tinoji
Last active January 8, 2018 01:57
Show Gist options
  • Save tinoji/6bff1e24db24e03c683e3d9dd34f143c to your computer and use it in GitHub Desktop.
Save tinoji/6bff1e24db24e03c683e3d9dd34f143c to your computer and use it in GitHub Desktop.
照明のスイッチをON/OFFするためのArduinoスケッチ
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);
}
@tinoji
Copy link
Author

tinoji commented Jan 3, 2018

littlebitsを使用(cloudbits+serve2個)。IFTTTからOutput Levelの違う2つの出力をー。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment