tabs to spaces
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 23 Jul 2023 09:24:25 +0000 (11:24 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 23 Jul 2023 09:24:25 +0000 (11:24 +0200)
1/gumb.py

index 36beb82..0f8666e 100755 (executable)
--- a/1/gumb.py
+++ b/1/gumb.py
@@ -6,12 +6,12 @@ import pygame
 #import os
 import serial
 ser = serial.Serial(
-       port='/dev/ttyAMA0',
-       baudrate=9600,
-       parity=serial.PARITY_NONE,
-       stopbits=serial.STOPBITS_ONE,
-       bytesize=serial.EIGHTBITS,
-       timeout=0.1
+    port='/dev/ttyAMA0',
+    baudrate=9600,
+    parity=serial.PARITY_NONE,
+    stopbits=serial.STOPBITS_ONE,
+    bytesize=serial.EIGHTBITS,
+    timeout=0.1
 )
 
 ser.open()
@@ -39,41 +39,41 @@ def main():
         if GPIO.input(26):
              # the button is being pressed, so turn on the green LED
              # and turn off the red LED
-                        #             GPIO.output(24,True)
-                        #             GPIO.output(25,False)
+             #             GPIO.output(24,True)
+             #             GPIO.output(25,False)
              print "button false"
              if trenutni==2:
-                               dobar = False
-                               trenutni=1
+                dobar = False
+                trenutni=1
              while dobar!=True:
-                               print "poslao na matricu"                        
-#                              time.sleep(1)                           
-                               ON = "\x14\x82\x80\x81"
-                               ser.write(ON)
-#                              dobar=True
-#                              time.sleep(0.01)
-                               inp = ser.read(size=4)
-                               print inp.encode("hex")                         
-                               if inp.encode("hex") == "54828081":
-                                       dobar=True                              
+                print "poslao na matricu"             
+#                time.sleep(1)                
+                ON = "\x14\x82\x80\x81"
+                ser.write(ON)
+#                dobar=True
+#                time.sleep(0.01)
+                inp = ser.read(size=4)
+                print inp.encode("hex")                
+                if inp.encode("hex") == "54828081":
+                    dobar=True                
              pygame.mixer.music.play()
              while pygame.mixer.music.get_busy() == True:
-                 continue                       
+                 continue             
         else:
-             print "button true"               
+             print "button true"        
              if trenutni==1:
-                               dobar = False
-                               trenutni=2
+                dobar = False
+                trenutni=2
              while dobar!=True:
-                               print "poslao na matricu"                        
-                               ON = "\x14\x81\x80\x81"
-                               time.sleep(1)
-                               ser.write(ON)
-#                              time.sleep(0.01)
-                               inp = ser.read(size=4)
-                               print inp.encode("hex")                         
-                               if inp.encode("hex") == "54818081":
-                                       dobar=True
+                print "poslao na matricu"             
+                ON = "\x14\x81\x80\x81"
+                time.sleep(1)
+                ser.write(ON)
+#                time.sleep(0.01)
+                inp = ser.read(size=4)
+                print inp.encode("hex")                
+                if inp.encode("hex") == "54818081":
+                    dobar=True
 
 
         time.sleep(0.2)