changeset 5:0c868a2c7cda

Add example to the micropython library
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Sun, 09 Oct 2016 12:32:14 +0200
parents f614c50ac75a
children bae09c8dd4da
files micropython/d1servo18ch.py
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/micropython/d1servo18ch.py	Sun Oct 09 12:25:21 2016 +0200
+++ b/micropython/d1servo18ch.py	Sun Oct 09 12:32:14 2016 +0200
@@ -1,6 +1,18 @@
 import ustruct
 
 class Servos:
+    """
+    Control 18-channel Servo Shield.
+
+    >>> from d1servo18ch import Servos
+    >>> from machine import I2C, Pin
+    >>> i2c = I2C(Pin(5), Pin(4))
+    >>> servos = Servos(i2c)
+    >>> for channel in range(18):
+    ...     servos[channel] = 1500
+    ...
+
+    """
     def __init__(self, i2c, address=0x0A):
         self.i2c = i2c
         self.address = address