Hi, I’m trying to send bluetooth serial data from raspberry pi to mbot.
On mbot, I recycled the code from this thread:
Like this:
#include <Arduino.h>
#include <Wire.h>
#include <SoftwareSerial.h>
#include <MeMCore.h>
void setup(){
Serial.begin(115200);
Serial.println("Start");
}
void loop(){
if((Serial.available()) > (0)){
Serial.println(Serial.read());
}else{
Serial.println("No");
}
_delay(1);
_loop();
}
void _delay(float seconds){
long endTime = millis() + seconds * 1000;
while(millis() < endTime)_loop();
}
void _loop(){
}
On Pi side, I just wrote very simple python code, like this, with pairing Pi to mbot on rfcomm0.
#! /usr/bin/python
import serial
from time import sleep
bluetoothSerial = serial.Serial( "/dev/rfcomm0", baudrate=115200 )
bluetoothSerial.write("a")
Python code works without any errors. However, mbot couldn’t receive any data from Serial port.
Am I missing something? Appreciate your help. Thanks.