Arduino UNO

Hi All,

I am very new to Arduino UNO board and its programming. what i need to is :slight_smile:

  1. If 0x01 is received on serial port then make Pin13 high and then low.Below is the code for the same:

void setup() { // put your setup code here, to run once: Serial.begin(19200); pinMode(LED_BUILTIN, OUTPUT); Serial.flush(); }

void loop() { /* check if data has been sent from the computer: / if (Serial.available() > 0) { / read the most recent byte */

byte byteRead [1] ; byteRead [0] = Serial.read();

switch (byteRead[0]) { case 0x01: // Serial.println("Command 1 is received"); digitalWrite(LED_BUILTIN, HIGH); delay(20); digitalWrite(LED_BUILTIN, LOW); break; } } }

What the issues are:

  1. I need to connect digital pin 13 to the button pads of IR remote.When i power up the board it sends high signal to my IR remote button pads irrespective of the 0x01 received on the serial port.

  2. Also on start up it shows extra 3 or 4 bytes with values 255.From were this data is coming to Rx buffer of board?

3.Also sometimes it misses to send the signal to IR remote even after receiving 0x01 on serial port.

Can you please help me to figure out whats is wrong with this piece of code?

Thanks a lot in advance :)

Hi, Welcome to the forum.

Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom.. :)

How do you propose to send 0x01 to the Arduino? Perhaps you mean the character '1' which has the value 0x31?

Also on start up it shows extra 3 or 4 bytes with values 255.From were this data is coming to Rx buffer of board?

Where are you seeing that? Your code does not seem to print anything.

Also sometimes it misses to send the signal to IR remote even after receiving 0x01 on serial port.

How do you know?

Your Title is not very informative. If you edit your Original Post you can change the title to something useful - perhaps "How to receive data and trigger IR device"

...R Serial Input Basics