-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode.h
43 lines (40 loc) · 1.17 KB
/
node.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/***************************************************************************/
// File [node.h]
// Author [Erik Kuo, Joshua Lin]
// Synopsis [Code for managing car movement when encounter a node]
// Functions [/* add on yout own! */]
// Modify [2020/03/027 Erik Kuo]
/***************************************************************************/
#include <SoftwareSerial.h>
#include <Wire.h>
/*===========================import variable===========================*/
int extern l1, l2, l3, r3, r2, r1 ;
int extern _Tp;
double extern vL, vR ;
/*===========================import variable===========================*/
// TODO: add some function to control your car when encounter a node
// here are something you can try: left_turn, right_turn... etc.
void turn_left(){
vL = -60 ;
vR = 80 ;
MotorWriting( vL, vR ) ;
delay( 800 ) ;
}
void turn_right(){
vL = 80 ;
vR = -60 ;
MotorWriting( vL, vR ) ;
delay( 800 ) ;
}
void turn_around(){
vL = 100 ;
vR = -80 ;
MotorWriting( vL, vR ) ;
delay( 800 ) ;
}
void go_through(){
vL = 80 ;
vR = 80 ;
MotorWriting( vL, vR ) ;
delay( 1000 ) ;
}