4d60ae62 |
1 | /* |
2 | This program is free software: you can redistribute it and/or modify |
3 | it under the terms of the GNU Affero General Public License as |
4 | published by the Free Software Foundation, either version 3 of the |
5 | License, or (at your option) any later version. |
6 | |
7 | This program is distributed in the hope that it will be useful, |
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 | GNU Affero General Public License for more details. |
11 | |
12 | You should have received a copy of the GNU Affero General Public License |
13 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
14 | */ |
15 | |
16 | // define which pins are connected to which components |
17 | int left_motor_speed = 3; |
18 | int left_motor_forward = 4; |
19 | int left_motor_backward = 5; |
20 | |
21 | int right_motor_speed = 10; |
22 | int right_motor_forward = 9; |
23 | int right_motor_backward = 8; |
24 | |
25 | void setup(){ |
26 | pinMode(left_motor_speed, OUTPUT); |
27 | pinMode(left_motor_forward, OUTPUT); |
28 | pinMode(left_motor_backward, OUTPUT); |
29 | |
30 | pinMode(right_motor_speed, OUTPUT); |
31 | pinMode(right_motor_forward, OUTPUT); |
32 | pinMode(right_motor_backward, OUTPUT); |
33 | |
34 | digitalWrite(left_motor_speed, LOW); |
35 | digitalWrite(left_motor_forward, LOW); |
36 | digitalWrite(left_motor_backward, LOW); |
37 | |
38 | digitalWrite(right_motor_speed, LOW); |
39 | digitalWrite(right_motor_forward, LOW); |
40 | digitalWrite(right_motor_backward, LOW);} |
41 | |
42 | void loop(){ |
43 | digitalWrite(left_motor_forward, HIGH); |
44 | digitalWrite(left_motor_backward, LOW); |
45 | analogWrite(left_motor_speed, 128); |
46 | |
47 | digitalWrite(right_motor_forward, HIGH); |
48 | digitalWrite(right_motor_backward, LOW); |
49 | analogWrite(right_motor_speed, 128);} |