mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 06:38:29 +02:00
Updated maple PDE to have Roll gyro and led latency tester
This commit is contained in:
parent
a4daf22e37
commit
ec91637f1a
3 changed files with 21 additions and 5 deletions
|
@ -8,10 +8,15 @@ Read a set of analog input lines and echo their readings over the serial port wi
|
||||||
// 17,18,19 = Head Accelerometer
|
// 17,18,19 = Head Accelerometer
|
||||||
|
|
||||||
|
|
||||||
#define NUM_CHANNELS 5
|
#define NUM_CHANNELS 6
|
||||||
#define MSECS_PER_SAMPLE 10
|
#define MSECS_PER_SAMPLE 10
|
||||||
|
|
||||||
int inputPins[NUM_CHANNELS] = {19,20,15,16,17};
|
#define LED_PIN 12
|
||||||
|
|
||||||
|
int inputPins[NUM_CHANNELS] = {19,20,18,15,16,17};
|
||||||
|
|
||||||
|
int LED_on = 0;
|
||||||
|
unsigned int total_count = 0;
|
||||||
|
|
||||||
unsigned int time;
|
unsigned int time;
|
||||||
|
|
||||||
|
@ -29,6 +34,7 @@ void setup()
|
||||||
accumulate[i] = measured[i];
|
accumulate[i] = measured[i];
|
||||||
}
|
}
|
||||||
pinMode(BOARD_LED_PIN, OUTPUT);
|
pinMode(BOARD_LED_PIN, OUTPUT);
|
||||||
|
pinMode(LED_PIN,OUTPUT);
|
||||||
time = millis();
|
time = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +42,13 @@ void loop()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
sampleCount++;
|
sampleCount++;
|
||||||
|
total_count++;
|
||||||
|
if (total_count % 20172 == 0) {
|
||||||
|
LED_on = !LED_on;
|
||||||
|
if (LED_on) digitalWrite(LED_PIN, HIGH);
|
||||||
|
else digitalWrite(LED_PIN, LOW);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < NUM_CHANNELS; i++) {
|
for (i = 0; i < NUM_CHANNELS; i++) {
|
||||||
accumulate[i] += analogRead(inputPins[i]);
|
accumulate[i] += analogRead(inputPins[i]);
|
||||||
}
|
}
|
||||||
|
@ -47,10 +60,12 @@ void loop()
|
||||||
SerialUSB.print(" ");
|
SerialUSB.print(" ");
|
||||||
accumulate[i] = 0;
|
accumulate[i] = 0;
|
||||||
}
|
}
|
||||||
//SerialUSB.print("(");
|
SerialUSB.print(sampleCount);
|
||||||
//SerialUSB.print(sampleCount);
|
SerialUSB.print(" ");
|
||||||
//SerialUSB.print(")");
|
if (LED_on) SerialUSB.print("1");
|
||||||
|
else SerialUSB.print("0");
|
||||||
SerialUSB.println("");
|
SerialUSB.println("");
|
||||||
|
|
||||||
sampleCount = 0;
|
sampleCount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
1
main.cpp
1
main.cpp
|
@ -466,6 +466,7 @@ void update_pos(float frametime)
|
||||||
}
|
}
|
||||||
// Decrease forward velocity
|
// Decrease forward velocity
|
||||||
fwd_vel *= (1.f - 4.0*frametime);
|
fwd_vel *= (1.f - 4.0*frametime);
|
||||||
|
|
||||||
|
|
||||||
// Update forward vector based on pitch and yaw
|
// Update forward vector based on pitch and yaw
|
||||||
fwd_vec[0] = -sinf(render_yaw*PI/180);
|
fwd_vec[0] = -sinf(render_yaw*PI/180);
|
||||||
|
|
Loading…
Reference in a new issue