Control drones with a proper joystick
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Saitek-X52-PPM.ino 875B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include <hid.h>
  2. #include <hiduniversal.h>
  3. #include <usbhub.h>
  4. // Satisfy IDE, which only needs to see the include statment in the ino.
  5. #ifdef dobogusinclude
  6. #include <spi4teensy3.h>
  7. #include <SPI.h>
  8. #endif
  9. #include "hidjoystickrptparser.h"
  10. USB Usb;
  11. USBHub Hub(&Usb);
  12. HIDUniversal Hid(&Usb);
  13. JoystickEvents JoyEvents;
  14. JoystickReportParser Joy(&JoyEvents);
  15. void setup() {
  16. Serial.begin(115200);
  17. #if !defined(__MIPSEL__)
  18. while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
  19. #endif
  20. Serial.println("Start");
  21. if (Usb.Init() == -1)
  22. Serial.println("OSC did not start.");
  23. delay(200);
  24. if (!Hid.SetReportParser(0, &Joy))
  25. ErrorMessage<uint8_t > (PSTR("SetReportParser"), 1);
  26. }
  27. void loop() {
  28. Usb.Task();
  29. }