-
Notifications
You must be signed in to change notification settings - Fork 0
/
ESPRodPuppetFirmware.ino
53 lines (44 loc) · 1.38 KB
/
ESPRodPuppetFirmware.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
47
48
49
50
51
52
53
/* Basic Raw HID Example
Teensy can send/receive 64 byte packets with a
dedicated program running on a PC or Mac.
You must select Raw HID from the "Tools > USB Type" menu
Optional: LEDs should be connected to pins 0-7,
and analog signals to the analog inputs.
This example code is in the public domain.
*/
#include <SimplePacketComs.h>
#include <Esp32SimplePacketComs.h>
#include <Esp32WifiManager.h>
#include <ESP32Servo.h>
#include "SetServos.h"
#include "server/NameCheckerServer.h"
#include <WiiChuck.h>
UDPSimplePacket coms;
WifiManager manager;
String * name =new String("rodpuppet");
Accessory nunchuck1;
SetServos * servos;
uint8_t cp[NUM_SERVO_SERVED] = {90,90,90,90,90,90,90,90,90,90,90,90};
Delta * fb = new Delta(0,1,2,cp);
Delta * left = new Delta(3,4,5,cp);
Delta * right = new Delta(6,7,8,cp);
void setup() {
//manager.setup();
Serial.begin(115200);
coms.attach(new NameCheckerServer(name));
servos = new SetServos();
coms.attach(servos);
nunchuck1.begin();
}
void loop() {
//manager.loop();
//coms.server();
if(manager.getState()!=Connected){
nunchuck1.readData(); // Read inputs and update maps
//nunchuck1.printInputs(); // Print all inputs
fb->update(nunchuck1.values[0], nunchuck1.values[1]);
left->update(nunchuck1.values[0], nunchuck1.values[1]);
right->update(nunchuck1.values[0], nunchuck1.values[1]);
servos->event((float *)cp);
}
}