changeset 29:623ca8ae5f4e

Bug in button code
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Thu, 23 Jun 2016 20:00:47 +0200
parents f63f9d678d11
children d23589b4df44
files basics.rst
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/basics.rst	Mon Jun 20 12:14:14 2016 +0200
+++ b/basics.rst	Thu Jun 23 20:00:47 2016 +0200
@@ -191,7 +191,7 @@
     while True:
         if not button.value():
             led.value(not led.value())
-            while button.value():
+            while not button.value():
                 pass
 
 We have used ``Pin.IN`` because we want to use ``gpio14`` as an input pin, on
@@ -224,7 +224,7 @@
         if not button.value():
             led.value(not led.value())
             time.sleep_ms(300)
-            while button.value():
+            while not button.value():
                 pass
 
 Here we wait 3/10 of a second -- too fast for a human to notice, but enough for