2019-11-11 22:26:34 +01:00
|
|
|
#define SENSORS_CPP
|
|
|
|
#include "sensors.h"
|
|
|
|
|
|
|
|
void initSensors(){
|
2019-11-27 17:17:18 +01:00
|
|
|
pinMode(SWITCH_DX, INPUT);
|
|
|
|
pinMode(SWITCH_SX, INPUT);
|
2019-12-02 14:50:59 +01:00
|
|
|
vector<DataSource*> dUs { new DataSourceUS(&Wire1, int(112)), new DataSourceUS(&Wire1, int(113)),
|
|
|
|
new DataSourceUS(&Wire1, int(114)), new DataSourceUS(&Wire1, int(115)) };
|
2019-11-27 17:17:18 +01:00
|
|
|
|
2019-11-13 16:26:03 +01:00
|
|
|
drive = new DriveController(new Motor(12, 11, 2, 45),new Motor(25, 24, 5, 135), new Motor(27, 26, 6, 225), new Motor(21, 22, 23, 315));
|
2019-11-18 18:11:26 +01:00
|
|
|
compass = new DataSourceBNO055();
|
2019-11-18 15:07:46 +01:00
|
|
|
ball = new DataSourceBall(&Serial4, 57600);
|
2019-11-18 17:15:32 +01:00
|
|
|
camera = new DataSourceCamera(&Serial2, 19200);
|
2019-12-02 14:50:59 +01:00
|
|
|
usCtrl = new DataSourceController(dUs);
|
2019-12-02 17:25:22 +01:00
|
|
|
|
|
|
|
game = new Game();
|
2019-11-11 22:26:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void updateSensors(){
|
2019-11-18 18:11:26 +01:00
|
|
|
compass->update();
|
|
|
|
ball->update();
|
|
|
|
camera->update();
|
2019-12-02 14:50:59 +01:00
|
|
|
// usCtrl->test();
|
2019-11-11 22:26:34 +01:00
|
|
|
}
|