From 56fc2d1bcf33e46343770bbe8cda41f01299c64c Mon Sep 17 00:00:00 2001 From: "Brady L. Hurlburt" Date: Thu, 22 Jul 2021 22:03:02 -0400 Subject: [PATCH 1/3] Fix left and right motors --- inc/drivers/cutebot/CutebotMotor.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/drivers/cutebot/CutebotMotor.h b/inc/drivers/cutebot/CutebotMotor.h index 5029f11..4245213 100644 --- a/inc/drivers/cutebot/CutebotMotor.h +++ b/inc/drivers/cutebot/CutebotMotor.h @@ -6,8 +6,8 @@ #include "inc/drivers/Motor.h" enum CutebotMotorId { - CUTEBOT_MOTOR_ID_RIGHT = 1, - CUTEBOT_MOTOR_ID_LEFT, + CUTEBOT_MOTOR_ID_LEFT = 1, + CUTEBOT_MOTOR_ID_RIGHT, }; class CutebotMotor : public Motor From 524cd8a9ed99d63ab3bc24cd79e6bff7ca525fda Mon Sep 17 00:00:00 2001 From: "Brady L. Hurlburt" Date: Thu, 22 Jul 2021 22:06:13 -0400 Subject: [PATCH 2/3] Fix line sensor left-right --- source/drivers/cutebot/CutebotLineSensors.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/drivers/cutebot/CutebotLineSensors.cpp b/source/drivers/cutebot/CutebotLineSensors.cpp index 93f70a1..abc2eb1 100644 --- a/source/drivers/cutebot/CutebotLineSensors.cpp +++ b/source/drivers/cutebot/CutebotLineSensors.cpp @@ -12,12 +12,12 @@ CutebotLineSensors::CutebotLineSensors(MicroBitIO &_io) : io(_io), readings {0, uint16_t CutebotLineSensors::getLeftReading() { - return this->readings[1]; + return this->readings[0]; } uint16_t CutebotLineSensors::getRightReading() { - return this->readings[0]; + return this->readings[1]; } void CutebotLineSensors::idleTick() From 8dccf8342eb4a748299f0a4f5f94209efa1e0132 Mon Sep 17 00:00:00 2001 From: "Brady L. Hurlburt" Date: Thu, 22 Jul 2021 22:45:46 -0400 Subject: [PATCH 3/3] Poll cutebot sensors faster --- inc/drivers/cutebot/Cutebot.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/inc/drivers/cutebot/Cutebot.h b/inc/drivers/cutebot/Cutebot.h index 47df950..b9fbd87 100644 --- a/inc/drivers/cutebot/Cutebot.h +++ b/inc/drivers/cutebot/Cutebot.h @@ -9,10 +9,10 @@ // Reference: https://github.com/elecfreaks/pxt-cutebot -#define CUTEBOT_PERIOD_LINE_SENSORS 500 -#define CUTEBOT_START_COUNT_LINE_SENSORS 300 -#define CUTEBOT_PERIOD_DISTANCE_SENSOR 500 -#define CUTEBOT_START_COUNT_DISTANCE_SENSOR 100 +#define CUTEBOT_PERIOD_LINE_SENSORS 100 +#define CUTEBOT_START_COUNT_LINE_SENSORS 0 +#define CUTEBOT_PERIOD_DISTANCE_SENSOR 100 +#define CUTEBOT_START_COUNT_DISTANCE_SENSOR 50 // I2C address of the Cutebot const char CUTEBOT_I2C_ADDR = 0x10 << 1;