Answer the question
In order to leave comments, you need to log in
Arduino reset when connected via serial port, what to do?
There is a very simple code
#define LED 5
int input = 0; // variable to keep the data from the serial port
void setup() {
pinMode(LED,OUTPUT); // declare the LED's pin as output
Serial.begin(9600); // connect to the serial port
digitalWrite(LED,HIGH);
}
void loop () {
input = Serial.read(); // read the serial port
// if the input is '1' turn the LED ON, if '0' turn it OFF
if (input == '1' ) {
digitalWrite(LED,LOW);
Serial.println("LED13 is ON");
}
if (input == '0'){
digitalWrite(LED, HIGH);
Serial.println("LED13 is OFF");
}
}
Answer the question
In order to leave comments, you need to log in
There is a special jumper - on the DTR-> Reset line - you need to remove it. No other friend.
While I began to write the value in eeprom, which is then read at startup. But I suspect that this is not a very correct way, but for the test, let it stay for a while.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question