Hi,
I know this topic is quite old but perhaps there are some of you using the code (https://github.com/incmve/roomba-eps8266/) of @incmve.
I’m doing so and everything is working fine. Beside sending comands I also want to read the sensor data. But this is not working for my set-up. Are you reading sensor data already? Do you had problems to get it working? Can someone help me to get it working?
My Hardware consists:
For testing I use this code down below. But I only get zeros printed out in the serial monitor even if wait some time and lift the roomba up from time to time.
#include <SoftwareSerial.h>
//* RX is digital pin 10 (connect to TX of other device - iRobot DB25
// pin 2)
//* TX is digital pin 11 (connect to RX of other device - iRobot DB25
// pin 1)
#define rxPin D5
#define txPin D6
#define bumpRight (sensorbytes[0] & 0x01)
#define bumpLeft (sensorbytes[0] & 0x02)
// set up a new software serial port:
SoftwareSerial softSerial = SoftwareSerial(rxPin, txPin);
int inByte = 0; // incoming serial byte
/*************************************************************
SETUP
*************************************************************/
void setup()
{
delay(2000); // Needed to let the robot initialize
// define pin modes for software tx, rx pins:
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
pinMode(BUILTIN_LED, OUTPUT); // set onboard LED as output
// start the the SoftwareSerial port 57600 bps (robot’s default)
softSerial.begin(115200); //115200
// start hardware serial port
Serial.begin(115200);
Serial.println("Starting to communicate");
softSerial.write(128); // This command starts the OI.
softSerial.write(131); // set mode to safe (see p.7 of OI manual)
Serial.println("Writing Values to SoftSerial");
delay(2000);
//softSerial.write(135); // This command starts the OI.
//Serial.println("Start Cleaning");
}
/*************************************************************
LOOP
*************************************************************/
void loop()
{
softSerial.write(142); // requests the OI to send a packet of
// sensor data bytes
softSerial.write(9); // request cliff sensor value specifically
delay(500); // poll sensor 4 times a second
if (softSerial.available() > 0) {
inByte = softSerial.read();
}
Serial.println(inByte);
// checkBumpSensors();
// delay(100);
}