Arduino Uno USB communication

Hi,

I have load in arduino uno an example program to control RGB leds. Sending a string by usb leds switch on. I open arduino serial monitor tool and usb works: I send a string 255,127,35 and leds switch on to correct ligth intensity. Now I send the same string by Hyperterminal but leds don't switch on.
In arduino program the end of string is '\n'. In fact by serial monitor tool I set 'NL'. Can you help me?

thank you

What does Hyperterminal send at the end of the string ?
Maybe send a user input such as # at the end of the string and detect that in the Arduino code instead of ‘\n’ or if Hyperterminal sends a Carriage Return detect ‘\r’

Have a look at the examples in serial input basics - simple and reliable.

...R

#include <avr/wdt.h>
#define RELAY1  7
void setup() 
{
  wdt_enable(WDTO_8S);
  Serial.begin(9600); // set serial speed
  pinMode(RELAY1, OUTPUT); // set LED as output
}

void loop()
{
  wdt_reset();
  int val = Serial.read() - '0';
  if (val == 1)
  { 
    digitalWrite(RELAY1, LOW);
    Serial.println("relay status on");
  }
  else if (val == 0)
  {
    digitalWrite(RELAY1, HIGH);
    Serial.println("relay status OFF");
  }
  Serial.println("main executing");
  delay(1000);



}

here simple code you can modify accordingly as per your requirement

AMPS-N:
[here simple code you can modify accordingly as per your requirement

@AMPS-N, you seem to be addicted to the unnecessary complexity of the watchdog timer.

I have an Atmega 328 running for about 2 years now without any WDT code.

...R