diff --git a/include/sensors/linesys_2019.h b/include/sensors/linesys_2019.h index f8a7d3c..eeafd82 100644 --- a/include/sensors/linesys_2019.h +++ b/include/sensors/linesys_2019.h @@ -7,14 +7,14 @@ #include "vars.h" -#define S1I A14 -#define S1O A15 -#define S2I A16 -#define S2O A17 -#define S3I A20 -#define S3O A0 -#define S4I A1 -#define S4O A2 +#define S1I 21 //A14 N +#define S1O 20 //A15 +#define S2I 17 //A16 E +#define S2O 16 //A17 +#define S3I 15 //A20 S +#define S3O 14 //A0 +#define S4I 23 //A1 O +#define S4O 22 //A2 #define LINE_THRESH 90 #define EXTIME 200 diff --git a/include/sensors/linesys_camera.h b/include/sensors/linesys_camera.h index 6a301f3..0ab82ab 100644 --- a/include/sensors/linesys_camera.h +++ b/include/sensors/linesys_camera.h @@ -7,14 +7,14 @@ #include "vars.h" -#define S1I A14 -#define S1O A15 -#define S2I A16 -#define S2O A17 -#define S3I A20 -#define S3O A0 -#define S4I A1 -#define S4O A2 +#define S1I 21 //A14 N +#define S1O 20 //A15 +#define S2I 17 //A16 E +#define S2O 16 //A17 +#define S3I 15 //A20 S +#define S3O 14 //A0 +#define S4I 23 //A1 O +#define S4O 22 //A2 #define LINE_THRESH_CAM 90 #define EXIT_TIME 100 diff --git a/include/vars.h b/include/vars.h index 3c31965..e808e4a 100755 --- a/include/vars.h +++ b/include/vars.h @@ -3,10 +3,19 @@ #define GLOBAL_SPD_MULT 1.0 +/*SWS and LEDS are to be tested and implemented in the code. +the new setup is the one commented, leds have to be written +in the 32U4 code*/ + #define LED_R 20 #define LED_Y 17 #define LED_G 13 #define BUZZER 30 #define SWITCH_SX 28 -#define SWITCH_DX 29 \ No newline at end of file +#define SWITCH_DX 29 + +/*#define BUZZER 6 +#define SWITCH_1 39 +#define SWITCH_2 38 +#define SWITCH_3 33*/ diff --git a/src/sensors/data_source_bt.cpp b/src/sensors/data_source_bt.cpp index 4fb2e66..c91d852 100644 --- a/src/sensors/data_source_bt.cpp +++ b/src/sensors/data_source_bt.cpp @@ -1,30 +1,32 @@ #include "sensors/data_source_bt.h" +//if needed, substitute Serial1 with Serial3 to return to the old code setup + DataSourceBT :: DataSourceBT(HardwareSerial* ser_, int baud) : DataSource(ser_, baud){ // connect(); } void DataSourceBT :: connect(){ - Serial3.print("$"); - Serial3.print("$"); - Serial3.print("$"); + Serial1.print("$"); + Serial1.print("$"); + Serial1.print("$"); delay(100); - Serial3.println("C"); + Serial1.println("C"); } void DataSourceBT :: reconnect(){ if(!comrade){ if(!b){ - Serial3.print("$"); - Serial3.print("$"); - Serial3.print("$"); + Serial1.print("$"); + Serial1.print("$"); + Serial1.print("$"); }else{ - Serial3.println("C"); + Serial1.println("C"); } b = !b; }else{ - Serial3.println("---"); + Serial1.println("---"); } } @@ -32,7 +34,7 @@ void DataSourceBT :: test(){ if (DEBUG.available()) { DEBUG.println((char)DEBUG.read()); } - if (Serial3.available()) { - Serial3.write((char)Serial3.read()); + if (Serial1.available()) { + Serial1.write((char)Serial1.read()); } } \ No newline at end of file diff --git a/src/sensors/sensors.cpp b/src/sensors/sensors.cpp index 36ec625..13afdc4 100644 --- a/src/sensors/sensors.cpp +++ b/src/sensors/sensors.cpp @@ -11,13 +11,16 @@ void initSensors(){ dUs = { new DataSourceUS(&Wire1, int(112)), new DataSourceUS(&Wire1, int(113)), new DataSourceUS(&Wire1, int(114)), new DataSourceUS(&Wire1, int(115)) }; - - 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)); + drive = new DriveController(new Motor(11, 12, 4, 45),new Motor(24, 25, 5, 135), new Motor(26, 27, 2, 225), new Motor(28, 29, 3, 315)); + //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)); compass = new DataSourceBNO055(); - ball = new DataSourceBall(&Serial4, 57600); - camera = new DataSourceCameraConic(&Serial2, 19200); + ball = new DataSourceBall(&Serial2, 57600); + //ball = new DataSourceBall(&Serial4, 57600); + camera = new DataSourceCameraConic(&Serial3, 19200); + //camera = new DataSourceCameraConic(&Serial2, 19200); usCtrl = new DataSourceCtrl(dUs); - bt = new DataSourceBT(&Serial3, 115200); + bt = new DataSourceBT(&Serial1, 115200); + //bt = new DataSourceBT(&Serial3, 115200); } void updateSensors(){