2019-11-11 22:26:34 +01:00
|
|
|
#define SENSORS_CPP
|
2020-02-29 22:10:53 +01:00
|
|
|
#include "sensors/sensors.h"
|
2019-11-11 22:26:34 +01:00
|
|
|
|
|
|
|
void initSensors(){
|
2019-11-27 17:17:18 +01:00
|
|
|
pinMode(SWITCH_DX, INPUT);
|
|
|
|
pinMode(SWITCH_SX, INPUT);
|
2019-12-05 11:53:01 +01:00
|
|
|
|
2020-01-15 13:55:51 +01:00
|
|
|
pinMode(LED_R, OUTPUT);
|
|
|
|
pinMode(LED_Y, OUTPUT);
|
|
|
|
pinMode(LED_G, OUTPUT);
|
2020-05-05 18:13:14 +02:00
|
|
|
|
2020-05-06 11:46:41 +02:00
|
|
|
drive = new DriveController(new Motor(11, 12, 4, 35), new Motor(24, 25, 5, 135), new Motor(26, 27, 2, 225), new Motor(28, 29, 3, 325));
|
2020-05-05 17:57:43 +02: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();
|
2020-05-05 17:57:43 +02:00
|
|
|
ball = new DataSourceBall(&Serial2, 57600);
|
|
|
|
//ball = new DataSourceBall(&Serial4, 57600);
|
|
|
|
camera = new DataSourceCameraConic(&Serial3, 19200);
|
|
|
|
//camera = new DataSourceCameraConic(&Serial2, 19200);
|
|
|
|
bt = new DataSourceBT(&Serial1, 115200);
|
|
|
|
//bt = new DataSourceBT(&Serial3, 115200);
|
2019-12-26 17:44:58 +01:00
|
|
|
}
|
2019-11-11 22:26:34 +01:00
|
|
|
|
|
|
|
void updateSensors(){
|
2019-12-09 19:08:05 +01:00
|
|
|
role = digitalRead(SWITCH_DX);
|
|
|
|
camera->goalOrientation = digitalRead(SWITCH_SX);
|
|
|
|
|
2019-11-18 18:11:26 +01:00
|
|
|
compass->update();
|
|
|
|
ball->update();
|
2020-02-21 13:37:32 +01:00
|
|
|
camera->update();
|
2019-11-11 22:26:34 +01:00
|
|
|
}
|