-
Notifications
You must be signed in to change notification settings - Fork 0
/
RCM-Original.h
79 lines (66 loc) · 2.26 KB
/
RCM-Original.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/**
Bits of code that might be helpful when starting a program with an original RCM board
https://github.com/RCMgames/RCM_hardware_documentation_and_user_guide
// from https://github.com/RCMgames/useful-code/tree/main/boards
*/
// all the servo drivers
JMotorDriverEsp32Servo servo1Driver = JMotorDriverEsp32Servo(port1);
JMotorDriverEsp32Servo servo2Driver = JMotorDriverEsp32Servo(port2);
JMotorDriverEsp32Servo servo3Driver = JMotorDriverEsp32Servo(port3);
JMotorDriverEsp32Servo servo4Driver = JMotorDriverEsp32Servo(port4);
JMotorDriverEsp32Servo servo5Driver = JMotorDriverEsp32Servo(port5);
// all the motor drivers
JMotorDriverEsp32L293 motorADriver = JMotorDriverEsp32L293(portA);
JMotorDriverEsp32L293 motorBDriver = JMotorDriverEsp32L293(portB);
JMotorDriverEsp32L293 motorCDriver = JMotorDriverEsp32L293(portC);
JMotorDriverEsp32L293 motorDDriver = JMotorDriverEsp32L293(portD);
// variables for the drivers
float servo1Val = 0;
float servo2Val = 0;
float servo3Val = 0;
float servo4Val = 0;
float servo5Val = 0;
float motorAVal = 0;
float motorBVal = 0;
float motorCVal = 0;
float motorDVal = 0;
// set all the motor drivers (you can put this in Enabled())
servo1Driver.set(servo1Val);
servo2Driver.set(servo2Val);
servo3Driver.set(servo3Val);
servo4Driver.set(servo4Val);
servo5Driver.set(servo5Val);
motorADriver.set(motorAVal);
motorBDriver.set(motorBVal);
motorCDriver.set(motorCVal);
motorDDriver.set(motorDVal);
// enable all the motor drivers (you can put this in Enable())
servo1Driver.enable();
servo2Driver.enable();
servo3Driver.enable();
servo4Driver.enable();
servo5Driver.enable();
motorADriver.enable();
motorBDriver.enable();
motorCDriver.enable();
motorDDriver.enable();
// disable all the motor drivers (you can put this in Disable())
servo1Driver.disable();
servo2Driver.disable();
servo3Driver.disable();
servo4Driver.disable();
servo5Driver.disable();
motorADriver.disable();
motorBDriver.disable();
motorCDriver.disable();
motorDDriver.disable();
// receive values for all the variables (you can put this in WifiDataToParse())
servo1Val = EWD::recvFl();
servo2Val = EWD::recvFl();
servo3Val = EWD::recvFl();
servo4Val = EWD::recvFl();
servo5Val = EWD::recvFl();
motorAVal = EWD::recvFl();
motorBVal = EWD::recvFl();
motorCVal = EWD::recvFl();
motorDVal = EWD::recvFl();