Skip to content

Commit dc4abd8

Browse files
committed
update settings for cam jam
Change motor pins for CamJam edukit 3
1 parent c9800d9 commit dc4abd8

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

coderbot.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@
2525
import sonar
2626

2727
PIN_MOTOR_ENABLE = 22
28-
PIN_LEFT_FORWARD = 25
29-
PIN_LEFT_BACKWARD = 24
30-
PIN_RIGHT_FORWARD = 4
31-
PIN_RIGHT_BACKWARD = 17
28+
PIN_LEFT_FORWARD = 8
29+
PIN_LEFT_BACKWARD = 7
30+
PIN_RIGHT_FORWARD = 10
31+
PIN_RIGHT_BACKWARD = 9
3232
PIN_PUSHBUTTON = 11
33-
PIN_SERVO_3 = 9
34-
PIN_SERVO_4 = 10
35-
PIN_SONAR_1_TRIGGER = 18
36-
PIN_SONAR_1_ECHO = 7
37-
PIN_SONAR_2_TRIGGER = 18
38-
PIN_SONAR_2_ECHO = 8
39-
PIN_SONAR_3_TRIGGER = 18
40-
PIN_SONAR_3_ECHO = 23
41-
PIN_ENCODER_LEFT = 14
42-
PIN_ENCODER_RIGHT = 15
33+
#PIN_SERVO_3 = 9
34+
#PIN_SERVO_4 = 10
35+
PIN_SONAR_1_TRIGGER = 17
36+
PIN_SONAR_1_ECHO = 18
37+
#PIN_SONAR_2_TRIGGER = 18
38+
#PIN_SONAR_2_ECHO = 8
39+
#PIN_SONAR_3_TRIGGER = 18
40+
#PIN_SONAR_3_ECHO = 23
41+
#PIN_ENCODER_LEFT = 14
42+
#PIN_ENCODER_RIGHT = 15
4343

4444
PWM_FREQUENCY = 100 #Hz
4545
PWM_RANGE = 100 #0-100
@@ -75,7 +75,7 @@ def __init__(self, servo=False, motor_trim_factor=1.0):
7575
self._is_moving = False
7676
self.sonar = [sonar.Sonar(self.pi, PIN_SONAR_1_TRIGGER, PIN_SONAR_1_ECHO),
7777
sonar.Sonar(self.pi, PIN_SONAR_2_TRIGGER, PIN_SONAR_2_ECHO),
78-
sonar.Sonar(self.pi, PIN_SONAR_3_TRIGGER, PIN_SONAR_3_ECHO)]
78+
sonar.Sonar(self.pi, PIN_SONAR_3_TRIGGER, PIN_SONAR_3_ECHO)]
7979
self._encoder_cur_left = 0
8080
self._encoder_cur_right = 0
8181
self._encoder_target_left = -1
@@ -127,7 +127,7 @@ def _dc_motor(self, speed_left=100, speed_right=100, elapse=-1, steps_left=-1, s
127127
self._encoder_cur_right = 0
128128
self._encoder_target_left = steps_left
129129
self._encoder_target_right = steps_right
130-
130+
131131
self._is_moving = True
132132
if speed_left < 0:
133133
speed_left = abs(speed_left)
@@ -210,7 +210,7 @@ def callback(self, gpio, level, tick):
210210
elapse = self._cb_elapse.get(gpio)
211211
if level == 0:
212212
self._cb_last_tick[gpio] = tick
213-
elif tick - self._cb_last_tick[gpio] > elapse:
213+
elif tick - self._cb_last_tick[gpio] > elapse:
214214
self._cb_last_tick[gpio] = tick
215215
print "pushed: ", level, tick
216216
cb()
@@ -226,5 +226,3 @@ def reboot(self):
226226

227227
def sleep(self, elapse):
228228
time.sleep(elapse)
229-
230-

0 commit comments

Comments
 (0)