Pages: [1]   Go Down
Author Topic: Dimmer example question  (Read 535 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

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?
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1266374135

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
Logged

0
Offline Offline
Edison Member
*
Karma: 0
Posts: 1103
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: