Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pynxc/tutorial_samples/5_light.py
diff options
context:
space:
mode:
Diffstat (limited to 'pynxc/tutorial_samples/5_light.py')
-rw-r--r--pynxc/tutorial_samples/5_light.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/pynxc/tutorial_samples/5_light.py b/pynxc/tutorial_samples/5_light.py
new file mode 100644
index 0000000..0f2cbee
--- /dev/null
+++ b/pynxc/tutorial_samples/5_light.py
@@ -0,0 +1,14 @@
+DEFINE THRESHOLD=40
+
+def main():
+ DefineSensors(None,None,LIGHT,None)
+ OnFwd(OUT_AC, 75)
+ while True:
+ if SensorVal(2) > THRESHOLD:
+ OnRev(OUT_C, 75)
+ Wait(100)
+
+ while SensorVal(2) > THRESHOLD:
+ pass
+
+ OnFwd(OUT_AC, 75)