Last active
February 23, 2016 04:02
-
-
Save vasmani/2c5dfd4cc8ac328fca71 to your computer and use it in GitHub Desktop.
구피 사료주기 - RF와 모터 이용
This file contains hidden or 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
| #include "RCSwitch.h" | |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <Servo.h> | |
| RCSwitch mySwitch = RCSwitch(); | |
| Servo myservo; | |
| int pos = 0; | |
| void setup() { | |
| myservo.attach(9); | |
| mySwitch.enableReceive(0); | |
| } | |
| void loop() { | |
| if (mySwitch.available()) { | |
| int value = mySwitch.getReceivedValue(); | |
| if(value == 1111){ | |
| for(int i=0; i < 7; i++){ | |
| for(pos = 15; pos < 170; pos += 1){ | |
| myservo.write(pos); | |
| delay(10); | |
| } | |
| for(pos = 170; pos>=15; pos-=1){ | |
| myservo.write(pos); | |
| delay(10); | |
| } | |
| } | |
| myservo.write(15); | |
| } | |
| mySwitch.resetAvailable(); | |
| delay(100); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment