]> vault307.fbx.one Git - micorpython_ir.git/commitdiff
Docs: provide basic usage examples.
authorPeter Hinch <peter@hinch.me.uk>
Fri, 3 Apr 2020 05:34:51 +0000 (06:34 +0100)
committerPeter Hinch <peter@hinch.me.uk>
Fri, 3 Apr 2020 05:34:51 +0000 (06:34 +0100)
README.md
TRANSMITTER.md
images/circuits.fzz

index 2eb3a47f35bbe7760bbc3cb6288f4ea8538efd5e..750a131bbe8fe01615e263c01dba58033ce0cf44 100644 (file)
--- 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.
index 2cf169aabd4c879b601b7f2ce56f88a158298f98..3e3290e28d56f2c66ca8e73d9e33891ae17ed21f 100644 (file)
@@ -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:  
index 7ecee24c990016c6821d293cd215f0fc1567bb81..ea36cc8916696408266c8147c8c3b86d0e16be60 100644 (file)
Binary files a/images/circuits.fzz and b/images/circuits.fzz differ