xref: /aosp_15_r20/external/pigweed/pw_sys_io_arduino/docs.rst (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1*61c4878aSAndroid Build Coastguard Worker.. _module-pw_sys_io_arduino:
2*61c4878aSAndroid Build Coastguard Worker
3*61c4878aSAndroid Build Coastguard Worker-----------------
4*61c4878aSAndroid Build Coastguard Workerpw_sys_io_arduino
5*61c4878aSAndroid Build Coastguard Worker-----------------
6*61c4878aSAndroid Build Coastguard Worker
7*61c4878aSAndroid Build Coastguard Worker``pw_sys_io_arduino`` implements the ``pw_sys_io`` facade over
8*61c4878aSAndroid Build Coastguard Worker`Arduino's Serial interface <https://www.arduino.cc/reference/en/language/functions/communication/serial/>`_.
9*61c4878aSAndroid Build Coastguard Worker
10*61c4878aSAndroid Build Coastguard WorkerOn initialization it runs Arduino's first ``Serial`` interface at a 115200 baud
11*61c4878aSAndroid Build Coastguard Workerrate:
12*61c4878aSAndroid Build Coastguard Worker
13*61c4878aSAndroid Build Coastguard Worker.. code-block:: cpp
14*61c4878aSAndroid Build Coastguard Worker
15*61c4878aSAndroid Build Coastguard Worker   Serial.begin(115200);
16*61c4878aSAndroid Build Coastguard Worker
17*61c4878aSAndroid Build Coastguard Worker   // Wait for serial port to be available
18*61c4878aSAndroid Build Coastguard Worker   while (!Serial) {}
19*61c4878aSAndroid Build Coastguard Worker
20*61c4878aSAndroid Build Coastguard WorkerAfter ``Serial.begin(115200)`` it will busy wait until a host connects to the
21*61c4878aSAndroid Build Coastguard Workerserial port.
22*61c4878aSAndroid Build Coastguard Worker
23*61c4878aSAndroid Build Coastguard Worker.. seealso::
24*61c4878aSAndroid Build Coastguard Worker   - :ref:`target-arduino` target documentation for a list of working hardware.
25*61c4878aSAndroid Build Coastguard Worker   - :ref:`module-pw_arduino_build` for caveats when running Pigweed on top of
26*61c4878aSAndroid Build Coastguard Worker     the Arduino API.
27