PA003. 파이션 아두이노 조이스틱 그래픽(2)
import serial from turtle import Turtle, Screen def HVmove(T, S, forwardAmount): for i in range (forwardAmount): T.forward(i) S .update() def JoyMove (T, S, ser): xy= ser.readline() xy=xy.decode('utf-8') #xy=xy.rstlip() xy=xy.split(",") horizontal=int(xy[0]) vertical =int(xy[1]) if (horizontal >0): T.setheading(0) HVmove(T, S, horizontal) elif (horizontal 0): T.setheading (270) HVmove (T, S,vert..
PA002. 파이션아두이노 버튼그래픽(1)
D2 버튼 --> "D30" 전송 D3 버튼 --->"M20" 전송 회로구성 버튼핀이 수평(노란선)되게 배치합니다. 배선 : A, B, C, D, E를 연결합니다. void setup() { Serial.begin(9600); pinMode(13,1); pinMode(2,INPUT_PULLUP); pinMode(3,INPUT_PULLUP); attachInterrupt(0, degree, RISING); attachInterrupt(1, forward, RISING); } void loop() { } void degree() { Serial.println("D30"); digitalWrite(13,0); } void forward() { Serial.println("M25"); digitalWrite(1..