# UART/Comms

## UART:

The PIC processor on the Spirit Mainboard is able to relay UART messages from the Arduino processor to several possible end points. The UART should be initiated by setting the desired communication path and setting the baud rate.

.

**PIC\_SetComUARTMode();**\
`PIC_SetComUARTMode(); //sets the target device for UART communication`  \
`PIC_SetComUARTMode(0); //WiFi Mode - Sends UART traffic to the ESP8266 module socket`  \
`PIC_SetComUARTMode(1); //BlueTooth Mode - Sends UART traffic to the HC-06 module socket`  \
`PIC_SetComUARTMode(2); //XBee Mode - Sends UART traffic to the XBee module socket`  \
`PIC_SetComUARTMode(3); //Pi Mode - Sends UART traffic to UART port on the Raspberry Pi`

This function configures a selector switch on the Rover main board to communicate with the desired UART target. Transmit and Receive traffic will go to/from the intended UART target until the mode is changed.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://plumgeek.gitbook.io/spirit-rover-code-quick-reference/arduino-code/uartcomms.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
