터치센서를 이용한 아두이노 선풍기 코딩 도와주십시오
페이지 정보
작성자 민죽 작성일18-12-11 19:49 조회3,489회 댓글0건본문
const int switchPin = 2;
const int motorPin = 9;
int switchState = 0;
void setup() {
pinMode(motorPin, OUTPUT);
pinMode(7, INPUT);
}
void loop() {
switchState = digitalRead(switchPin);
if(digitalRead(7) == HIGH) {
digitalWrite(motorPin, HIGH);
}
{
boolean state = false;
if(digitalRead(7) == HIGH) {
digitalWrite(motorPin, LOW);
}
}
}
-------------------------------------------------------------------------
터치센서를 누르면 선풍기가 켜지고, 다시 한번 더 누르면 선풍기가 꺼지도록하고 싶은데
안됩니다ㅠㅠㅠ내일 시험인데 제발 도와주십시오 !
댓글 : 0
조회수 : 3,489
등록된 댓글이 없습니다.