37 lines
871 B
Arduino
37 lines
871 B
Arduino
#include <Wire.h>
|
|
#include "BotNetwork.h"
|
|
#include "MotionController.h"
|
|
#include "DisplayManager.h"
|
|
|
|
// Initialize Objects
|
|
BotNetwork botNetwork("PfLANze", "isteinbisschenengandiehals", "JackBot-AP", "robot-control");
|
|
MotionController motion;
|
|
DisplayManager display(5, 16, 17); // TFT_CS, TFT_DC, TFT_RST
|
|
|
|
void setup() {
|
|
Serial.begin(115200);
|
|
Wire.begin();
|
|
Wire.setClock(400000);
|
|
|
|
display.begin();
|
|
display.drawCenteredText("Connecting...", ST77XX_YELLOW);
|
|
if (botNetwork.begin(3323)) {
|
|
display.drawCenteredText("WiFi: Connected", ST77XX_CYAN);
|
|
} else {
|
|
display.drawCenteredText("AP: JackBot", ST77XX_MAGENTA);
|
|
}
|
|
|
|
motion.begin();
|
|
}
|
|
|
|
void loop() {
|
|
uint8_t buffer[512];
|
|
int size = botNetwork.readPacket(buffer, 512);
|
|
|
|
if (size > 0) {
|
|
botNetwork.parsePacket(buffer, size, &motion, &display);
|
|
}
|
|
|
|
motion.update();
|
|
display.update();
|
|
} |