mirror of
https://github.com/esphome/esphome-docs.git
synced 2025-03-02 04:01:52 +01:00
Add uart.write action
This commit is contained in:
parent
961bf33861
commit
cdcb1ec054
@ -47,7 +47,7 @@ Advanced options:
|
||||
This sets up some flags so that custom code should compile correctly
|
||||
- **includes** (*Optional*, list of files): A list of C[++] files to include in the main (auto-generated) sketch file
|
||||
for custom components. The paths in this list are relative to the directory where the YAML configuration file
|
||||
is in. Should have file extension ``.h``
|
||||
is in. Should have file extension ``.h`` - See :ref:`esphome-includes` for more info.
|
||||
- **libraries** (*Optional*, list of libraries): A list of `platformio libraries <https://platformio.org/lib>`__
|
||||
to include in the project. See `platformio lib install <https://docs.platformio.org/en/latest/userguide/lib/cmd_install.html>`__.
|
||||
|
||||
@ -219,6 +219,34 @@ You can view a full list of platformio options here: https://docs.platformio.org
|
||||
upload_speed: 115200
|
||||
board_build.f_flash: 80000000L
|
||||
|
||||
.. _esphome-includes:
|
||||
|
||||
``includes``
|
||||
------------
|
||||
|
||||
With ``includes`` you can include source files in the generated platformio project.
|
||||
All files declared with this option are copied to the project each time it is compiled.
|
||||
|
||||
You can always look at the generated platformio project (``<CONFIG_DIR>/<NODENAME>``) to see what
|
||||
is happening - and if you want you can even copy the include files directly into the ``src/`` folder.
|
||||
The ``includes`` option is only a helper option that does that for you.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
# Example configuration entry
|
||||
esphome:
|
||||
# ...
|
||||
includes:
|
||||
- my_switch.h
|
||||
|
||||
This option behaves differently depending on what the included file is pointing at:
|
||||
|
||||
- If the include string is pointing at a directory, the entire directory tree is copied over
|
||||
to the src/ folder.
|
||||
- If the include string is point at a header file (.h, .hpp, .tcc) - it is copied in the src/ folder
|
||||
AND included in the main.cpp. This way the lambda code can access it.
|
||||
- If the include str
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
|
@ -68,6 +68,25 @@ The ESP8266 has two UARTs; the second of which is TX-only. Only a limited set of
|
||||
use either ``tx_pin: GPIO1`` and ``rx_pin: GPIO3``, or ``tx_pin: GPIO15`` and ``rx_pin: GPIO13``. ``UART1`` must
|
||||
use ``tx_pin: GPIO2``. Any other combination of pins will result in use of a software UART.
|
||||
|
||||
.. _uart-write_action:
|
||||
|
||||
``uart.write`` Action
|
||||
---------------------
|
||||
|
||||
This :ref:`Action <config-action>` sends a defined UART signal to the given UART bus.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
on_...:
|
||||
- uart.write: 'Hello World'
|
||||
|
||||
# Raw data
|
||||
- uart.write: [0x00, 0x20, 0x42]
|
||||
|
||||
# Templated, return type is std::vector<uint8_t>
|
||||
- uart.write: !lambda
|
||||
return {0x00, 0x20, 0x42};
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
|
@ -359,6 +359,7 @@ All Actions
|
||||
- :ref:`output.esp8266_pwm.set_frequency <output-esp8266_pwm-set_frequency_action>`
|
||||
- :ref:`sensor.integration.reset <sensor-integration-reset_action>`
|
||||
- :ref:`display.page.show_* <display-pages>`
|
||||
- :ref:`uart.write <uart-write_action>`
|
||||
|
||||
.. _config-condition:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user