Need help with Bluetooth and Arduino IDE


#1

Hello everyone!

I really want to dive deeper into the makeblock world, but unfortunatly going further as using the app or the mblock5 software is very confusing, because a lot of changes in the product were made and many official online tutorials and docs are clearly outdated. Dear makeblockteam, please work on this! :slight_smile:

I hope someone can help me out here:

What i have:

  • Ultimate 2.0 set incl. the Bluetooth v1 adapter (the rather new adapter with 6 pins - not! the old one on port 5)
  • Makeblock Bluetooth Dongle 4.0
  • Makeblock 5 and Arduino IDE
  • WIndows PC

What works:

  • Livemode with Mblock 5 (Zigzag Driver emulates COM-Port)
  • I can connect to this emulating Bluetooth COM-Port by using Arduino IDE or other terminal programs

What doesn’t work:

  • I can’t send and receive commands after connecting to that port over arduino ide

In the online documentation, i could only find libraries and example code for the old mBluetooth adapter, like here: http://learn.makeblock.com/en/me-bluetooth-moduledual-mode/

In the only lmakeblock ibrary package i could find, it is also only implemented for the old bluetooth adapter. That can’t work, because of this command:

MeBluetooth bluetooth(PORT_5);

The old bluetooth adapter was on port 5, but as far as i see i can’t initialize the “new” bluetooth adapter v1, because it is not available over a port command.

So what i like to know:

  • Is it possible to initialize the bluetooth adapter v1 over Arduino IDE?
  • If yes, what is the command?
  • If not: Is the only way to solve the problem using a non Makeblock bluetooth adapter, which is freely programmable and compatible to the Arduino MegaPi?

I hope someone can help me here. :slight_smile:

best regards
Alex

EDIT: I solved the problem in the meantime. I bought a Makeblock Me RJ25 Adapter and connected it with an RJ 25 cable to port 5. I connected the RJ25 Adapter with an AZDelivery HC-05 HC-06 Bluetooth Wireless RF-Transceiver-Modul (4 cables: GND to GND, VCC to VCC, S1 to RXD, S2 to TXD).

Then you can pair the HC-06 Bluetooth device with your computer bluetooth in the windows preferences. The Pairing code ist 1234. After that, i could choose COM4-Port in the Arduino IDE.

Once this is done, upload your own firmware over USB to the board. Here is my code:

#include “MeMegaPi.h”
#include <Wire.h>
#include <SoftwareSerial.h>
#include <stdio.h>

MeBluetooth bluetooth(Port5);

void setup()
{
serial2.begin(9600);
bluetooth.begin(9600);
}

void loop()
{
if(Serial2.available())
{
char a = Serial2.read();
switch(a)
{
case ‘w’:
COMMANDS
break;

case ‘s’:
COMMANDS
break;
}
}
}


#2

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