Bluetooth-Terminal as Serial Monitor


#1

Hi, I´m from Germany, 15 years old and a fan of your really cool robot-kits.

How can I make the following sketch give me an output on a Terminalprogram like Putty on windows or Blueterm on android. It should be just a test to get the thing work. In the long run I want to pass data through bluetooth - for example from the TestUltrasonicSensor-Sketch to a bluetooth-device… The Serial Monitor Part works flawless.

#include <Makeblock.h>
#include <SoftwareSerial.h>
#include <Arduino.h>
#include <Wire.h> 

MeBluetooth bluetooth(PORT_4);

int cnt = 0;    // Counter
void setup()

{   Serial.begin(9600);   // Initialization
    bluetooth.begin(9600); // Initialization bluetooth
}
void loop()
{   cnt++;
Serial.print("Hello BB from Arduino! Counter:"); //print message
Serial.println(cnt);    // print counter
delay(1000);   // wait 1 sec
}

I´m a abolute beginner. I already searched the internet for an explanation, but wasn´t succesful. I guess because of the Baseshield, Bluetooth isn´t just working like a normal serial port? How can i adapt the sketch to make it act like one, or even use Serial-functions like “print, println, etc.”.
Thanks in advance for any suggesttions.


#2
#include <Makeblock.h>
#include <SoftwareSerial.h>
#include <Arduino.h>
#include <Wire.h> 

MeBluetooth bluetooth(PORT_4);

int cnt = 0;    // Counter
void setup()

{   
    bluetooth.begin(9600); // Initialization bluetooth
}
void loop()
{   cnt++;
  bluetooth.write("Hello BB from Arduino! Counter:"); //print message
  bluetooth.write(cnt);    // print counter
delay(1000);   // wait 1 sec
}

You may try this code. bluetooth is just a normal serial device.


#3

Thanks for your answer. You are right, it should, but it doesn´t.

sketch_dec19a.ino: In function 'void loop()':
sketch_dec19a:16: error: invalid conversion from 'const char*' to 'uint8_t'
sketch_dec19a:16: error: initializing argument 1 of 'size_t MeSerial::write(uint8_t)'

If I cut out this part:

//bluetooth.write("Hello BB from Arduino! Counter:"); //print message

…and only focus on:

bluetooth.write(cnt);    // print counter

Output on Putty (Terminalprogramm) looks like this:

123456789:;<=>?@AB ...

Which is more than Igot before, but not what the sketch is suppossed to do. Anybody, any ideas what is going on? Thanks in advance.


#4

hi, carlmorlok.
the library code has been updated on Github. https://github.com/Makeblock-official/Makeblock-Library

now it can support “print” string like the native serial.


#5
#include <Makeblock.h>
#include <SoftwareSerial.h>
#include <Arduino.h>
#include <Wire.h> 

MeBluetooth bluetooth(PORT_4);

int cnt = 0;    // Counter
void setup()

{   
    bluetooth.begin(9600); // Initialization bluetooth
}
void loop()
{   cnt++;
  bluetooth.print("You guys from makeblock are awesome: "); //print message
  bluetooth.println(cnt);    // print counter
delay(1000);   // wait 1 sec
}

Now it works like a charm. Special Thanks to Huluwa,indream and not to forget xeecos for fixing the MeSerial and SoftSerial.

Just ordered the Advanced Kit Gold from www.exp-tech.de one of your distributors in Germany.

Tried to upload a screen capture from Putty, but it doesn´t let me. Anyway thanks a lot.


#6

I’m trying to do this and cannot get it to show on putty for windows. what settings do you have for everything?


#7

This is an, ahem, very big necropost.
But, anywho, what do you mean by “cannot get it to show”? That’s pretty broad, haha.


#8