From: Peter Hinch Date: Fri, 3 Apr 2020 05:34:51 +0000 (+0100) Subject: Docs: provide basic usage examples. X-Git-Url: https://vault307.fbx.one/gitweb/micorpython_ir.git/commitdiff_plain/639dbe8734879b1c2bd2ea353ab3089d722f8968?ds=sidebyside;hp=8ac6c4b0b81221439541db8f7bdbab29913da9bb Docs: provide basic usage examples. --- diff --git a/README.md b/README.md index 2eb3a47..750a131 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,13 @@ firmware builds. The receiver is cross platform and has been tested on Pyboard, ESP8266 and ESP32. +In a typical use case the receiver is employed at the REPL to sniff the address +and data values associated with buttons on a remote control. The transmitter is +then used in an application to send those codes, emulating the remote control. + +Other use cases involve running the receiver in an application. This enables an +IR remote to control a device such as a robot. + #### [Receiver docs](./RECEIVER.md) The transmitter driver is compatible with Pyboard (1.x and D series) and ESP32. diff --git a/TRANSMITTER.md b/TRANSMITTER.md index 2cf169a..3e3290e 100644 --- a/TRANSMITTER.md +++ b/TRANSMITTER.md @@ -85,6 +85,22 @@ It implements a class for each supported protocol, namely `NEC`, `SONY_12`, common abstract base class in `__init__.py`. The application instantiates the appropriate class and calls the `transmit` method to send data. +Basic usage on a Pyboard: +```python +from machine import Pin +from ir_tx.nec import NEC +nec = NEC(Pin('X1')) +nec.transmit(1, 2) # address == 1, data == 2 +``` +Basic usage on ESP32: +```python +from machine import Pin +from ir_tx.nec import NEC +pins = (Pin(23, Pin.OUT, value = 0), Pin(21, Pin.OUT, value = 0)) +nec = NEC(pins) +nec.transmit(1, 2) # address == 1, data == 2 +``` + #### Common to all classes Constructor args: diff --git a/images/circuits.fzz b/images/circuits.fzz index 7ecee24..ea36cc8 100644 Binary files a/images/circuits.fzz and b/images/circuits.fzz differ