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(){
|
2021-04-19 16:05:42 +02:00
|
|
|
pinMode(SWITCH_DX, INPUT);
|
|
|
|
pinMode(SWITCH_SX, INPUT);
|
|
|
|
pinMode(SWITCH_ID, INPUT);
|
2021-02-01 20:57:23 +01:00
|
|
|
|
2021-01-31 18:41:27 +01:00
|
|
|
drive = new DriveController(new Motor(12, 11, 4, 55), new Motor(25, 24, 5, 135), new Motor(27, 26, 2, 225), new Motor(29, 28, 3, 305));
|
2021-05-10 20:34:20 +02:00
|
|
|
// tone(BUZZER, 270, 250);
|
|
|
|
// delay(350);
|
2019-11-18 18:11:26 +01:00
|
|
|
compass = new DataSourceBNO055();
|
2021-05-10 20:34:20 +02:00
|
|
|
// tone(BUZZER, 275, 250);
|
|
|
|
// delay(350);
|
2021-05-10 18:28:41 +02:00
|
|
|
ball = new DataSourceBall(&BALL_32U4, 57600);
|
2021-05-10 20:34:20 +02:00
|
|
|
// tone(BUZZER, 280, 250);
|
|
|
|
// delay(350);
|
2020-05-05 17:57:43 +02:00
|
|
|
camera = new DataSourceCameraConic(&Serial3, 19200);
|
2021-05-10 20:34:20 +02:00
|
|
|
// tone(BUZZER, 285, 250);
|
|
|
|
// delay(350);
|
2021-05-14 01:57:49 +02:00
|
|
|
bt = new DataSourceBT(&Serial1, 9600);
|
2021-05-07 21:39:03 +02:00
|
|
|
roller = new Roller(30, 31, 1000, 2000, 500);
|
2021-06-07 12:06:08 +02:00
|
|
|
ballPresence = new DataSourceBallPresence(A22, true);
|
2019-12-26 17:44:58 +01:00
|
|
|
}
|
2019-11-11 22:26:34 +01:00
|
|
|
|
|
|
|
void updateSensors(){
|
2021-04-19 16:05:42 +02:00
|
|
|
role = digitalRead(SWITCH_DX);
|
2021-05-07 21:39:03 +02:00
|
|
|
camera->old_goalOrientation = camera ->goalOrientation;
|
2021-04-19 16:05:42 +02:00
|
|
|
camera->goalOrientation = digitalRead(SWITCH_SX);
|
|
|
|
robot_indentifier = digitalRead(SWITCH_ID);
|
2019-12-09 19:08:05 +01:00
|
|
|
|
2019-11-18 18:11:26 +01:00
|
|
|
compass->update();
|
|
|
|
ball->update();
|
2021-06-07 12:06:08 +02:00
|
|
|
ballPresence->update();
|
2020-02-21 13:37:32 +01:00
|
|
|
camera->update();
|
2021-05-07 21:39:03 +02:00
|
|
|
|
2021-05-14 01:57:49 +02:00
|
|
|
bt->update();
|
|
|
|
|
2021-05-07 21:39:03 +02:00
|
|
|
roller->update();
|
2019-11-11 22:26:34 +01:00
|
|
|
}
|