first commit, starting to work with a new setup

pull/1/head
u-siri-ous 2020-05-05 17:57:43 +02:00
parent bc0b19ccf1
commit e341214905
5 changed files with 47 additions and 33 deletions

View File

@ -7,14 +7,14 @@
#include "vars.h" #include "vars.h"
#define S1I A14 #define S1I 21 //A14 N
#define S1O A15 #define S1O 20 //A15
#define S2I A16 #define S2I 17 //A16 E
#define S2O A17 #define S2O 16 //A17
#define S3I A20 #define S3I 15 //A20 S
#define S3O A0 #define S3O 14 //A0
#define S4I A1 #define S4I 23 //A1 O
#define S4O A2 #define S4O 22 //A2
#define LINE_THRESH 90 #define LINE_THRESH 90
#define EXTIME 200 #define EXTIME 200

View File

@ -7,14 +7,14 @@
#include "vars.h" #include "vars.h"
#define S1I A14 #define S1I 21 //A14 N
#define S1O A15 #define S1O 20 //A15
#define S2I A16 #define S2I 17 //A16 E
#define S2O A17 #define S2O 16 //A17
#define S3I A20 #define S3I 15 //A20 S
#define S3O A0 #define S3O 14 //A0
#define S4I A1 #define S4I 23 //A1 O
#define S4O A2 #define S4O 22 //A2
#define LINE_THRESH_CAM 90 #define LINE_THRESH_CAM 90
#define EXIT_TIME 100 #define EXIT_TIME 100

View File

@ -3,10 +3,19 @@
#define GLOBAL_SPD_MULT 1.0 #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_R 20
#define LED_Y 17 #define LED_Y 17
#define LED_G 13 #define LED_G 13
#define BUZZER 30 #define BUZZER 30
#define SWITCH_SX 28 #define SWITCH_SX 28
#define SWITCH_DX 29 #define SWITCH_DX 29
/*#define BUZZER 6
#define SWITCH_1 39
#define SWITCH_2 38
#define SWITCH_3 33*/

View File

@ -1,30 +1,32 @@
#include "sensors/data_source_bt.h" #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){ DataSourceBT :: DataSourceBT(HardwareSerial* ser_, int baud) : DataSource(ser_, baud){
// connect(); // connect();
} }
void DataSourceBT :: connect(){ void DataSourceBT :: connect(){
Serial3.print("$"); Serial1.print("$");
Serial3.print("$"); Serial1.print("$");
Serial3.print("$"); Serial1.print("$");
delay(100); delay(100);
Serial3.println("C"); Serial1.println("C");
} }
void DataSourceBT :: reconnect(){ void DataSourceBT :: reconnect(){
if(!comrade){ if(!comrade){
if(!b){ if(!b){
Serial3.print("$"); Serial1.print("$");
Serial3.print("$"); Serial1.print("$");
Serial3.print("$"); Serial1.print("$");
}else{ }else{
Serial3.println("C"); Serial1.println("C");
} }
b = !b; b = !b;
}else{ }else{
Serial3.println("---"); Serial1.println("---");
} }
} }
@ -32,7 +34,7 @@ void DataSourceBT :: test(){
if (DEBUG.available()) { if (DEBUG.available()) {
DEBUG.println((char)DEBUG.read()); DEBUG.println((char)DEBUG.read());
} }
if (Serial3.available()) { if (Serial1.available()) {
Serial3.write((char)Serial3.read()); Serial1.write((char)Serial1.read());
} }
} }

View File

@ -11,13 +11,16 @@ void initSensors(){
dUs = { new DataSourceUS(&Wire1, int(112)), new DataSourceUS(&Wire1, int(113)), dUs = { new DataSourceUS(&Wire1, int(112)), new DataSourceUS(&Wire1, int(113)),
new DataSourceUS(&Wire1, int(114)), new DataSourceUS(&Wire1, int(115)) }; new DataSourceUS(&Wire1, int(114)), new DataSourceUS(&Wire1, int(115)) };
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)); //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(); compass = new DataSourceBNO055();
ball = new DataSourceBall(&Serial4, 57600); ball = new DataSourceBall(&Serial2, 57600);
camera = new DataSourceCameraConic(&Serial2, 19200); //ball = new DataSourceBall(&Serial4, 57600);
camera = new DataSourceCameraConic(&Serial3, 19200);
//camera = new DataSourceCameraConic(&Serial2, 19200);
usCtrl = new DataSourceCtrl(dUs); usCtrl = new DataSourceCtrl(dUs);
bt = new DataSourceBT(&Serial3, 115200); bt = new DataSourceBT(&Serial1, 115200);
//bt = new DataSourceBT(&Serial3, 115200);
} }
void updateSensors(){ void updateSensors(){