HackUTOKYOv2Pim

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit ee2fb557feff608d781f57c18434596226b2eff9
parent dc7fb1d2afc00a599cce358ba01e7dc28bd87825
Author: 諒太 林 <ryouturn@gmail.com>
Date:   Sat, 31 Aug 2024 03:47:55 +0900

update main

Diffstat:
Mhacku-tokyo-v2-pim.py | 23+++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/hacku-tokyo-v2-pim.py b/hacku-tokyo-v2-pim.py @@ -21,8 +21,13 @@ GPIO.setup(stepPin, GPIO.OUT) # 4:Step #GPIO.setup(27, GPIO.OUT)#27:MS2 #GPIO.setup(22, GPIO.OUT)#22:MS3 +placeN = 0 + def main(): GPIO.output(enabPin, 0) + placeN = 0 + for i in range(0,15): + escapeR while(True): ret, frame = cap.read() @@ -50,23 +55,28 @@ def main(): #逆かもしれない def escapeR(): + if(placeN >= 1500): + return print("escapeR") - GPIO.output(dircPin, 0) - for num in range(0,200): + GPIO.output(dircPin, 1) + for num in range(0,100): GPIO.output(stepPin, 1) time.sleep(0.001) GPIO.output(stepPin, 0) time.sleep(0.001) - time.sleep(1) + placeN += 1 + def escapeL(): print("escapeL") - GPIO.output(dircPin, 1) - for num in range(0,200): + if(placeN <= 0): + return + GPIO.output(dircPin, 0) + for num in range(0,100): GPIO.output(stepPin, 1) time.sleep(0.001) GPIO.output(stepPin, 0) time.sleep(0.001) - time.sleep(1) + placeN += 1 def mosaic(src): dst = cv2.resize(src, None, fx=0.1, fy=0.1, interpolation=cv2.INTER_NEAREST) @@ -114,6 +124,7 @@ try: main() except KeyboardInterrupt: print('interrupted!') + GPIO.output(enabPin,1) GPIO.cleanup() cap.release()