Arduino Uno USB communication


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.


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

void loop()
  int val = - '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");


here simple code you can modify accordingly as per your requirement

[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.