이슈 트렌드

아두이노 컴파일중 에러 원인 좀.....

2025. 9. 9. 오후 11:56:03
아두이노 컴파일중 에러 원인 좀.....

// 1) 세미콜론 제거 + 비교 연산자 수정 void encoder() { // ← 세미콜론 제거 clk_in = digitalRead(CLK); dt_in = digitalRead(DT); sw_in = digitalRead(SW); if (old_clk == HIGH && clk_in == LOW) { if (dt_in == HIGH) encoder_result = 1; // ← '==' 사용 } else if (old_dt == HIGH && dt_in == LOW) { if (clk_in == HIGH) encoder_result = -1; // ← '==' 사용 } else { encoder_result = 0; } if (old_sw == HIGH && sw_in == LOW) sw_result = 1; else sw_result = 0; old_clk = clk_in; old_dt = dt_in; old_sw = sw_in; } // 2) 함수명 오타도 가급적 교정 (desplay → display), 세미콜론 제거 void heatbed_display() { heatbed_10 = heatbed / 10; heatbed_1 = heatbed % 10; heatbed_20 = heatbed_change / 10; heatbed_2 = heatbed_change % 10; } // 3) LCD 라이브러리 차이: init()가 없으면 begin() 사용 void setup() { // lcd.init(); // 이게 없다면 ↓로 교체 lcd.begin(16, 2); // 사용 중인 라이브러리에 따라 이 형태가 정답 lcd.backlight(); pinMode(IR, INPUT_PULLUP); pinMode(DIRECTION, OUTPUT); pinMode(ENABLE, OUTPUT); pinMode(STEP, OUTPUT); pinMode(R, OUTPUT); pinMode(G, OUTPUT); pinMode(B, OUTPUT); pinMode(CLK, INPUT_PULLUP); // 엔코더는 PULLUP 권장 pinMode(DT, INPUT_PULLUP); pinMode(SW, INPUT_PULLUP); begin_menu(); }
목록으로 돌아가기