SHOW:
|
|
- or go back to the newest paste.
1 | - | const int numReadings = 10; |
1 | + | |
2 | if (digitalRead(11) == LOW) // Hat up________ | |
3 | - | int readings[numReadings]; // the readings from the analog input |
3 | + | { |
4 | - | int readIndex = 0; // the index of the current reading |
4 | + | Joystick.hat(0); |
5 | - | int total = 0; // the running total |
5 | + | |
6 | - | int average = 0; // the average |
6 | + | else if (digitalRead(12) == LOW) // Hat down________ |
7 | - | int inputPin = 38; |
7 | + | { |
8 | Joystick.hat(180); | |
9 | } | |
10 | - | int throttleNow; |
10 | + | else if (digitalRead(13) == LOW) // Hat right________ |
11 | - | int throttleThisSession; |
11 | + | { |
12 | - | int throttledeviation; |
12 | + | Joystick.hat(90); |
13 | - | int throttleVal; |
13 | + | |
14 | else if (digitalRead(14) == LOW) // Hat left________ | |
15 | - | int brakeNow; |
15 | + | { |
16 | - | int brakeThisSession; |
16 | + | Joystick.hat(270); |
17 | - | int brakedeviation; |
17 | + | |
18 | - | int brakeVal; |
18 | + | |
19 | { | |
20 | - | void setup() { |
20 | + | Joystick.hat(-1); |
21 | - | // Analog wheel |
21 | + | |
22 | ||
23 | - | // initialize serial communication with computer: |
23 | + | |
24 | - | Serial.begin(9600); |
24 | + | delay(50); |
25 | - | // initialize all the readings to 0: |
25 | + | } |