# UART Loop

**URL:** <https://forums.openmv.io/t/uart-loop/745>\
**Category:** OpenMV Boards\
**Created:** [June 5, 2018, 12:26pm UTC](https://forums.openmv.io/t/uart-loop/745 "2018-06-05T12:26:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_H](https://avatars.discourse-cdn.com/v4/letter/t/f17d59/32.png) [@Tim\_H](https://forums.openmv.io/u/Tim_H)\
**Post date:** [June 5, 2018, 12:26pm UTC](https://forums.openmv.io/t/uart-loop/745/1 "2018-06-05T12:26:22Z")

</div>

Hello, sorry for that Noobish Question, but how can i send a UART Message to the M7 back. I connected a Cable on both Pins. Rx and Tx but i get no answer. the read is still None.  
Is there anything i miss to implement?

Greets Tim

```python
import time
from pyb import UART
from pyb import LED

#LED Control -----------------

red_led = LED(1)
green_led = LED(2)
blue_led = LED(3)
ir_leds = LED(4)

# Always pass UART 3 for the UART number for your OpenMV Cam.
# The second argument is the UART baud rate. For a more advanced UART control
# example see the BLE-Shield driver.
uart = UART(1, 19200, bits=8, parity=None, stop=1, timeout_char = 10)

while(True):

    blue_led.on()
    time.sleep(1000)
    blue_led.off()
    uart.write('Hallo\n')
        
    print(uart.read(5))

```

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [June 5, 2018, 3:46pm UTC](https://forums.openmv.io/t/uart-loop/745/2 "2018-06-05T15:46:26Z")

</div>

Please use uart 3. Also, use the any() method to check for bytes first followed by read() if there are bytes.

---

<div class="post-metadata">

**Author:** ![Tim\_H](https://avatars.discourse-cdn.com/v4/letter/t/f17d59/32.png) [@Tim\_H](https://forums.openmv.io/u/Tim_H)\
**Post date:** [June 7, 2018, 10:02am UTC](https://forums.openmv.io/t/uart-loop/745/3 "2018-06-07T10:02:51Z")

</div>

mhh ok is there anything i have to look to it, cause i get no message back, i use the pins 4 and 5, but still noch message is incoming.

```python
import time
from pyb import UART
from pyb import LED

#LED Control -----------------

red_led = LED(1)
green_led = LED(2)
blue_led = LED(3)
ir_leds = LED(4)

# Always pass UART 3 for the UART number for your OpenMV Cam.
# The second argument is the UART baud rate. For a more advanced UART control
# example see the BLE-Shield driver.
uart = UART(3, 19200, bits=8, parity=None, stop=1, timeout_char = 100)

while(True):

    blue_led.on()
    time.sleep(1000)
    blue_led.off()
    
    uart.write('Hallo\n')
    uart.any()    
    print(uart.read())

```

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [June 24, 2018, 9:57pm UTC](https://forums.openmv.io/t/uart-loop/745/4 "2018-06-24T21:57:56Z")

</div>

Try a higher timeout\_char (1000).

---

<div class="post-metadata">

**Author:** ![OutoftheBOTS](https://avatars.discourse-cdn.com/v4/letter/o/bbce88/32.png) [@OutoftheBOTS](https://forums.openmv.io/u/OutoftheBOTS)\
**Post date:** [June 24, 2018, 10:01pm UTC](https://forums.openmv.io/t/uart-loop/745/5 "2018-06-24T22:01:03Z")

</div>

U do know that u need to connect the TX (transmit pin) one device goes to the RX (receive pin) on the other device.

---

<div class="post-metadata">

**Author:** ![Tim\_H](https://avatars.discourse-cdn.com/v4/letter/t/f17d59/32.png) [@Tim\_H](https://forums.openmv.io/u/Tim_H)\
**Post date:** [July 3, 2018, 9:09am UTC](https://forums.openmv.io/t/uart-loop/745/6 "2018-07-03T09:09:03Z")

</div>

Sure, all works fine, the cable wasnt that good connected. But works fine
