Arduino Uno 및 Windows 7을 사용하고 있습니다. 내 목표는 깜박이는 LED 표시등을 켜고 깜박이면 직렬 모니터에 "깜박임"을 인쇄하는 것입니다.동일한 Arduino 스크립트에서 Serial.print 및 digitalWrite 사용
아래 코드를 실행하면 2 초마다 "깜박임"이 직렬 모니터에 인쇄 될 수 있지만 표시등은 계속 켜져 있습니다. 선을 지울 때
표시등이 깜박이지만 아무 것도 인쇄되지 않습니다. 다음과 같이 내가 실행하고 코드는 다음과 같습니다
int LED3 = 0;
void setup() {
// When I comment out the line below, the lights flash as intended, but
// nothing prints. When I have the line below not commented out,
// printing works, but the lights are always on (ie do not blink).
Serial.begin(9600); // This is the line in question.
pinMode (LED3, OUTPUT);
}
void loop() {
Serial.println("Blink");
digitalWrite (LED3, HIGH);
delay(1000);
digitalWrite (LED3, LOW);
delay(1000);
}
나는이 문제의 원인을 명확하지 오전이 발생하고이 문제를 방지하는 방법을 이유에 대한 설명을 부탁드립니다. 고맙습니다!
예. 이 코드가 설명 된대로 동작하고 질문에 응답하는지 확인할 수 있습니다. 고맙습니다! – Marjoram
도움이되어서 기쁘게 생각합니다. – Billa