Sending bluetooth serial data to mbot


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(){

void loop(){
    if((Serial.available()) > (0)){

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 )

Python code works without any errors. However, mbot couldn’t receive any data from Serial port.

Am I missing something? Appreciate your help. Thanks.

Raspberry Pi 3 and mBot

Turned out I connected to Makeblock_LE, not Makeblock via bluetooth. Now it works.


Dear yuk,
I just tried your code in my raspberryPi and mBot, but the mBot can’t receive any data from raspberry Pi, can you pls help on this ? I’ve no idea how to solve this, thanks in advance.
mBot is looping:
there’s no error in python:

BTW, I connect Makeblock via bluetooth, not Makeblock_LE, is this right ?


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.