first commit

This commit is contained in:
gaohz committed 2024-06-06 04:13:43 +00:00
commit b8768c3ff8
249 files changed
+38439

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
import sys
import time
import wiringpi
from wiringpi import GPIO
I2C_ADDR = 0x48
BASE = 64
A0 = BASE+0
A1 = BASE+1
wiringpi.wiringPiSetup()
wiringpi.pcf8591Setup(BASE, I2C_ADDR)
while True:
try:
i = 0
while i < 2:
if 0 == i:
x = wiringpi.analogRead(A0)
if 1 == i:
y = wiringpi.analogRead(A1)
i += 1
print("X=%d Y=%d"%(x,y))
time.sleep(1)
except KeyboardInterrupt:
print('\nExit')
sys.exit(0)