위의 코드로 하시면 되는 듯 하네요!
코코아팹은 누구나 창의적 아이디어를 현실로 만들어 낼 수 있도록
만들고, 공유하고, 배울 수 있는 터전이
되고자 합니다.
아이디와 비밀번호를 잊으셨나요?아이디 / 비밀번호 찾기
코코아팹 회원이 아니신가요? 회원가입
컴파일오류
Jeipeo | 2018-01-21
|
|
---|---|
# include <servo.h> 지니어스 우노 컴파일 오류떠요 해결방안좀 알려주세요 |
|
|
|
이전글 | 카메라 전송 | 2018-01-20 |
다음글 | 블루투스로 서보모터 제어한 후 블루투스 연결 끊김... | 2018-01-22 |
하늘 2018-01-22 10:07:35
이 코드로 해 보세요
#include<Servo.h>
Servo myservo;
int sw=3;
int angle=0;
long bounceStartTime=0;
long debounce=50;
void setup() {
// put your setup code here, to run once:
myservo.attach(12);
pinMode(sw,INPUT_PULLUP);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(sw)==LOW){
if (bounceStartTime==0){
bounceStartTime=millis();
}
if(millis()-bounceStartTime>debounce){
angle+=20;
if(angle<180){
int angle=0;
}
myservo.write(angle);
bounceStartTime==0;
}
}
}
제 생각에는 int angle = O; 가 0이 아니라 O가 드어가서 오류가 난것 같내요.