Skip to content

Commit

Permalink
Pls work, Numpadv4
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrylshen authored Jan 13, 2018
1 parent b2524ed commit f782493
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions numpadv3.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,38 @@

# initialize gpio 23
gpio_1 = mraa.Gpio(29)

# initialize gpio 24
gpio_2 = mraa.Gpio(30)

gpio_3 = mraa.Gpio(26)
gpio_4 = mraa.Gpio(24)

# set gpio 23 to output
# set GPIO to input
gpio_1.dir(mraa.DIR_IN)

# set gpio 24 to output
gpio_1.write(1)
gpio_2.dir(mraa.DIR_IN)

gpio_2.write(1)
gpio_3.dir(mraa.DIR_IN)
gpio_3.write(1)
gpio_4.dir(mraa.DIR_IN)
gpio_4.write(1)

i = 0
ID = ""

while i < 4:
i += 1
if gpio_1 & gpio_2 == 1:
if gpio_1 and gpio_2 == 1:
ID += "1"
print (ID)
elif gpio_1 & gpio_3 == 1:
elif gpio_1 and gpio_3 == 1:
ID += "2"
print(ID)
elif gpio_1 & gpio_4 == 1:
elif gpio_1 and gpio_4 == 1:
ID += "3"
print(ID)
elif i == 3:
i = 0
ID = ""
sleep(1)



0 comments on commit f782493

Please sign in to comment.