빗물감지 모터창문 만들려고하는데 잘안되네요..빗물센서에 물이 닿을시 창문이 닫히게 모터 구동하려는데 변수가 잘못됬다고 코딩이 안됩니다
#include <Stepper.h>
const int stepsPerRevolution = 2048; //모터 각도 설정, 2048= 360도 회전 const int stepsPerRevolution2 = 1024; //모터 각도 설정, 1024= 180도 회전 Stepper myStepper(stepsPerRevolution,11,9,10,8); // 창문제어, 모터 드라이브에 연결된 핀 IN4, IN2, IN3, IN1
//빗방울센서 설정 int rainPin=A0; float rainValue=0;
rainValue=analogRead(rainPin);
if (rainValue <= 800) { myStepper.step(-stepsPerRevolution); delay(500); }
void setup() { Serial.begin(9600); //모니터용 시리얼 } void loop() { //센서값 읽기 int readingSensor = analogRead(rainPin);
//모니터 프로그램에 표시 Serial.println(readingSensor);
//10ms 대기 후 다시 loop로 시작작 delay(10); }
이렇게 입력했더니
sketch_oct04a:17:3: error: expected unqualified-id before 'if' if (rainValue <= 800) ^ exit status 1 'rainValue' does not name a type 이렇게 오류가 뜹니다.. 부탁드립니다
|