-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathArduino.ino
46 lines (39 loc) · 1.16 KB
/
Arduino.ino
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
// I would define the Arduino pins here at the top
#define ROLL_R_EN 8
#define PITCH_L_EN 16
void ArduinoSetup()
{
// set up the Arduino pins or other requirements
/*
pinMode(PITCH_R_EN, OUTPUT);
pinMode(PITCH_L_EN, OUTPUT);
*/
}
void ReadPots()
{
// this example supposes A2 is X and A3 is Y axis
/*
pos[0] = map(analogRead(A2), 0, 1023, minX, maxX);
pos[1] = map(analogRead(A3), 0, 1023, minY, maxY);
pos_updated = true;
*/
}
void DriveMotors() {
// X Axis Function
// Replace this with code specific to the motor you have connected
// forces[0] and forces[1] are the X,Y forces
// in the example below 10 is the minimum analog value to send if your motor does
// not react with a number less than 10
// 244 would be the maximum value you want to send
/*
if(forces[0] > 0) {
digitalWrite(ROLL_L_EN,HIGH);
digitalWrite(ROLL_R_EN,HIGH);
analogWrite(ROLL_R_PWM,map(abs(forces[0]), 0, 10000, 10, 244));
} else {
digitalWrite(ROLL_L_EN,HIGH);
digitalWrite(ROLL_R_EN,HIGH);
analogWrite(ROLL_L_PWM,map(abs(forces[0]), 0, 10000, 10, 244));
}
*/
}