Go Down

Topic: Dimmer example question (Read 974 times) previous topic - next topic



I've been playing around with the Dimmer example and writing code to talk to the Arduino from the computer.

One thing that perplexes me is that the brightness goes to 0 when communication is lost.  I don't see anything in the code that would do this.  This happens with both the serial monitor utility that comes with the Arduino IDE and my own software the communicates.

Why wouldn't the PWM continue with the last duty cycle value that was written to it?  I have tried a few modifications to the example, in an attempt to understand what is happening with the MCU.

* I've wrapped a while(1) loop around the serial read.
* I've pulled the analogWrite(ledPin, brightness) outside of the if(Serial.available()) statement.
* I've only allowed values higher than 0xEE to be written to the LED (my thought was, some stuff from the computer was writing a 0 to the serial port before closing the connection).

Does closing a serial connection reset the Arduino?


Turns out creating serial communication and then breaking it DOES reset my Arduino (Seeeduino Mega).

Thanks to all the good folks who posted in this thread:


So THATS what this M_RST_A switch does... Manual Reset, or Auto Reset.  In Manual Reset, the software does not reset when communication is made or broken.  ;D


Alas, this good switch is not available on standard Arduinos (but on Seeeduinos only)

Go Up