Add files via upload
This commit is contained in:
parent
26a68dfb00
commit
ee77c323fa
19
TrackFPV.ini
Normal file
19
TrackFPV.ini
Normal file
@ -0,0 +1,19 @@
|
||||
[migrations]
|
||||
last-migration-at=20160917_00~
|
||||
|
||||
[modules]
|
||||
filter-dll=Kalman
|
||||
tracker-dll=Joystick input
|
||||
|
||||
[opentrack-ui]
|
||||
pitch-invert-sign=true
|
||||
yaw-invert-sign=true
|
||||
|
||||
[tracker-joystick]
|
||||
axis-map-1=0
|
||||
axis-map-2=0
|
||||
axis-map-3=0
|
||||
axis-map-4=2
|
||||
axis-map-5=3
|
||||
axis-map-6=0
|
||||
joy-guid={D964FB90-A458-11E6-8001-444553540000}
|
72
TrackFPV.ino
Normal file
72
TrackFPV.ino
Normal file
@ -0,0 +1,72 @@
|
||||
// File: TrackFPV.ino
|
||||
// Date: 15.11.2016
|
||||
// Author: Hendrik Schutter
|
||||
// Version: a0.1
|
||||
|
||||
#include <Joystick.h>
|
||||
#include <CPPM.h>
|
||||
|
||||
int yawRaw;
|
||||
int pitchRaw;
|
||||
int min = -500;
|
||||
int max = 500;
|
||||
|
||||
void cppm_cycle(void){
|
||||
if (CPPM.synchronized()){
|
||||
yawRaw = CPPM.read_us(CPPM_GEAR) - 1500;
|
||||
pitchRaw = CPPM.read_us(CPPM_AUX1) - 1500;
|
||||
}
|
||||
else
|
||||
{
|
||||
Serial.println("Nix");
|
||||
}
|
||||
}
|
||||
|
||||
int getYAW() {
|
||||
yawRaw = yawRaw - 22;
|
||||
yawRaw = max_min(yawRaw);
|
||||
float f = yawRaw/5;
|
||||
return f;
|
||||
}
|
||||
|
||||
int getPITCH() {
|
||||
pitchRaw = pitchRaw - 22;
|
||||
pitchRaw = max_min(pitchRaw);
|
||||
float f = pitchRaw/5;
|
||||
return f;
|
||||
}
|
||||
|
||||
int max_min(int zahl) {
|
||||
if (zahl > max) {
|
||||
zahl = max;
|
||||
}
|
||||
if (zahl < min) {
|
||||
zahl = min;
|
||||
}
|
||||
return zahl;
|
||||
}
|
||||
|
||||
|
||||
void setup(){
|
||||
Serial.begin(9600);
|
||||
CPPM.begin();
|
||||
Joystick.begin(true);
|
||||
}
|
||||
|
||||
void loop(){
|
||||
cppm_cycle();
|
||||
Serial.print("Pitchraw: ");
|
||||
Serial.println(pitchRaw-22);
|
||||
Serial.print("YAWraw: ");
|
||||
Serial.println(yawRaw-22);
|
||||
|
||||
Serial.print("Pitch: ");
|
||||
Serial.println(getPITCH());
|
||||
Serial.print("YAW: ");
|
||||
Serial.println(getYAW());
|
||||
|
||||
Joystick.setYAxis(getPITCH());
|
||||
Joystick.setXAxis(getYAW());
|
||||
|
||||
delay(100);
|
||||
}
|
Loading…
Reference in New Issue
Block a user