Skip to content

Commit

Permalink
Added useful clock example
Browse files Browse the repository at this point in the history
  • Loading branch information
IGBC authored and Ashley Brown committed Jul 17, 2017
1 parent dd78846 commit 6d957b4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
18 changes: 0 additions & 18 deletions examples/articleExample.py

This file was deleted.

23 changes: 23 additions & 0 deletions examples/clock.py
Original file line number Diff line number Diff line change
@@ -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()
5 changes: 4 additions & 1 deletion examples/testexample.py
Original file line number Diff line number Diff line change
@@ -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())

Expand Down

0 comments on commit 6d957b4

Please sign in to comment.