HackUTOKYOv2Pim

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

commit 95045223a4e50878241192964670711f6150bc34
parent 2e1524ea71b36b40ef117142624c31f0016edd19
Author: 諒太 林 <ryouturn@gmail.com>
Date:   Sat, 31 Aug 2024 03:04:51 +0900

update test

Diffstat:
Mtest.py | 56+++++---------------------------------------------------
1 file changed, 5 insertions(+), 51 deletions(-)

diff --git a/test.py b/test.py @@ -15,65 +15,19 @@ camLimit = 5 #GPIO.setup(17, GPIO.OUT)#17:MS1 #GPIO.setup(27, GPIO.OUT)#27:MS2 #GPIO.setup(22, GPIO.OUT)#22:MS3 +GPIO.setmode(GPIO.BCM) # GPIOで指定 +GPIO.setup(enabPin, GPIO.OUT) # 2:Enableに定義 +GPIO.setup(dircPin, GPIO.OUT) # 3:Dir +GPIO.setup(stepPin, GPIO.OUT) # 4:Step def main(): - for num in range(0,200): + for num in range(0,10000): GPIO.output(stepPin, 1) time.sleep(0.001) GPIO.output(stepPin, 0) time.sleep(0.001) -#逆かもしれない -def escapeR(): - print("escapeR") -def escapeL(): - print("escapeL") - - - -def mosaic(src): - dst = cv2.resize(src, None, fx=0.1, fy=0.1, interpolation=cv2.INTER_NEAREST) - return cv2.resize(dst, src.shape[:2][::-1], interpolation=cv2.INTER_NEAREST) - -def difference(a, b): - if(a < b): - return b - a - return a - b - -def dump(src, keep): - #os.system('clear') - RightCount = 0 - LeftCount = 0 - for x in range(0, 32): - str = '' - for y in range(0, 24): - target = src[y*10][x*10] - diff = difference(keep[y][x],target) - if diff > 50: - str += '{:02} '.format(diff) - if(x >= 16): - RightCount += 1 - else: - LeftCount += 1 - else: - str += '-- ' - keep[y][x] = target - #print(str) - count=[RightCount,LeftCount] - return count -# 仕様メモcount=[RightCount,LeftCount] - -cap = cv2.VideoCapture(-1) - -cap.set(3,320) # WIDTH -cap.set(4,240) # HEIGHT -cap.set(5,30) # FPS - -keep = [[0] * 32 for i in range(24)] - -busy = True - try: main() except KeyboardInterrupt: