diff --git a/examples/articleExample.py b/examples/articleExample.py deleted file mode 100755 index bbfb6c6..0000000 --- a/examples/articleExample.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env pysketch - -def setup(): - def setup(): - pin = 18 - clock = 22 - GPIO.setmode(GPIO.BCM) - GPIO.setup(pin, GPIO.OUT) - GPIO.setup(clock, GPIO.OUT) - GPIO.output(pin, GPIO.High) - time.sleep(1000) - GPIO.output(pin, GPIO.Low) - -def loop(): - pass - -def cleanup(): - pass diff --git a/examples/clock.py b/examples/clock.py new file mode 100755 index 0000000..aef0f60 --- /dev/null +++ b/examples/clock.py @@ -0,0 +1,23 @@ +#!/usr/bin/env pysketch + +""" Variable Freqency Square Wave Generator """ + +delay = 0 +p = 0 + +def setup(freq: (float, "frequency of clock"), pin:(int, "Pin to output on") = 18): + global delay + global p + delay = freq/1000 + p = pin + GPIO.setmode(GPIO.BCM) + GPIO.setup(p, GPIO.OUT) + +def loop(): + global delay + global p + GPIO.output(p, 1 - GPIO.input(18)) + time.sleep(delay) + +def cleanup(): + GPIO.cleanup() diff --git a/examples/testexample.py b/examples/testexample.py index bb17008..da8c9bb 100644 --- a/examples/testexample.py +++ b/examples/testexample.py @@ -1,9 +1,12 @@ #!/usr/bin/env pysketch + +""" This sketch emulates a time wasteing tool """ + from typing import List sys = 0 -def setup(a:str, b:float, c, d:int = 4): +def setup(a:tuple, b:[float, 32.34212], c, d:int = 4): print("setup("+arg+")") print(dir())