diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/conwaylife.py | 3 | ||||
-rw-r--r-- | examples/mandel.py | 6 | ||||
-rw-r--r-- | examples/micropython.py | 8 | ||||
-rw-r--r-- | examples/pyb.py | 6 |
4 files changed, 20 insertions, 3 deletions
diff --git a/examples/conwaylife.py b/examples/conwaylife.py index fb62ce69e8..7c6ac4d548 100644 --- a/examples/conwaylife.py +++ b/examples/conwaylife.py @@ -34,10 +34,11 @@ def conway_go(num_frames): for i in range(num_frames): conway_step() # do 1 iteration lcd.show() # update the LCD + pyb.delay(300) # PC testing import lcd import pyb lcd = lcd.LCD(128, 32) conway_rand() -conway_go(100) +conway_go(1000) diff --git a/examples/mandel.py b/examples/mandel.py index 996132a915..d2b34fff83 100644 --- a/examples/mandel.py +++ b/examples/mandel.py @@ -1,3 +1,9 @@ +try: + import micropython +except: + pass + + def mandelbrot(): # returns True if c, complex, is in the Mandelbrot set @micropython.native diff --git a/examples/micropython.py b/examples/micropython.py new file mode 100644 index 0000000000..091c92deb3 --- /dev/null +++ b/examples/micropython.py @@ -0,0 +1,8 @@ +# micropython module placeholder for CPython + +# Dummy function decorators + +def nodecor(x): + return x + +byte_code = native = viper = nodecor diff --git a/examples/pyb.py b/examples/pyb.py index 5e24f40e4a..f7b52a2a1e 100644 --- a/examples/pyb.py +++ b/examples/pyb.py @@ -1,7 +1,9 @@ -# pyboard testing functions for PC +# pyboard testing functions for CPython +import time + def delay(n): - pass + time.sleep(float(n) / 1000) rand_seed = 1 def rand(): |