char INBYTE;
int LED = 13; // LED on pin 13
void setup() {
Serial.begin(9600);
Serial1.begin(9600);
pinMode(LED, OUTPUT);
}
void loop() {
Serial.println((int)INBYTE);
Serial1.println ("Press 1 to turn Arduino pin 13 LED ON or 0 to turn it OFF:");
while (!Serial1.available()); // stay here so long as COM port is empty
INBYTE = Serial1.read(); // read next available byte
if( INBYTE == '0' )digitalWrite(LED,LOW); // if it's a 0 (zero) tun LED off
if(INBYTE == '1' ) digitalWrite(LED, HIGH); // if it's a 1 (one) turn LED on
delay(50);
}
Hey guys,Im interfacing a HC 05(jy mcu) bluetooth module to my arduino mega 2560 connected at serial port 1 the bluetooth module is paired .I use blueterm app as a terminal here I receive the message ( Press 1 to turn Arduino pin 13 LED ON or 0 to turn it OFF:) then i press 1 or 0 nothing happens.I veiw it on the serial monitor i found garbage value like when i press 8 or 9 i get a value 32 and any number other then that a 0 value.I dont know whats wrong is it baudrate problem?