SPQR-Team-2019-REVAMPED/src/sensors/sensors.cpp

40 lines
1.1 KiB
C++
Raw Normal View History

#define SENSORS_CPP
#include "sensors/sensors.h"
void initSensors(){
pinMode(SWITCH_DX, INPUT);
pinMode(SWITCH_SX, INPUT);
pinMode(SWITCH_ID, INPUT);
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));
// tone(BUZZER, 270, 250);
// delay(350);
2019-11-18 18:11:26 +01:00
compass = new DataSourceBNO055();
// tone(BUZZER, 275, 250);
// delay(350);
ball = new DataSourceBall(&BALL_32U4, 57600);
// tone(BUZZER, 280, 250);
// delay(350);
camera = new DataSourceCameraConic(&Serial3, 19200);
// 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);
ballPresence = new DataSourceBallPresence(A13, true);
2019-12-26 17:44:58 +01:00
}
void updateSensors(){
role = digitalRead(SWITCH_DX);
2021-05-07 21:39:03 +02:00
camera->old_goalOrientation = camera ->goalOrientation;
camera->goalOrientation = digitalRead(SWITCH_SX);
robot_indentifier = digitalRead(SWITCH_ID);
2019-11-18 18:11:26 +01:00
compass->update();
ball->update();
ballPresence->update();
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();
}