Using 2.4GHz connection for Serial Monitor


#1

Greetings @Pioneer!

Is it possible to get to the serial monitor from the Arduino IDE that comes with mBlock using the 2.4GHz WiFi connection? I’m trying to investigate some odd behaviors with a program I’m writing for the mBot, and running a moving robot while tethered to a laptop is, well, something of a pain. :slightly_smiling:

Regards,

Charles


#2

I have been tinkering with the wireless serial stuff, it’s the next thing I need to learn. I only have a bluetooth module now, and there are some alternate/better wifi units for Arduino shield if I can get it talking to the Makeblock board.

As such, I have been looking at the products and code. If you have downloaded the Makeblock libraries, there are some good code examples under the file menu. Here is one which you might try:

There are extra () around the hash character on the include statements because it renders as font code in the posts

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

MeWifi Wifi(PORT_4);

void setup()
{
Serial.begin(9600);
Wifi.begin(9600);
Serial.println(“Bluetooth Start!”);
}

void loop()
{
char inDat;
char outDat;
if(Wifi.available())
{
char c = Wifi.read();
Serial.print©;

}
if(Serial.available())
{
    outDat = Serial.read();
    Wifi.write(outDat);
}

}


mBlock
#3

Thanks! I’ll give that a try.

Also, the wiki uses a Markdown variant, so if you want to put in code listings, just make sure each line starts with 4 spaces (see below as an example). :slight_smile:

#include 
#include 
#include 
#include

MeWifi Wifi(PORT_4);

void setup()
{
Serial.begin(9600);
Wifi.begin(9600);
Serial.println("Bluetooth Start!");
}

void loop()
{
char inDat;
char outDat;
if(Wifi.available())
{
char c = Wifi.read();
Serial.print(c);
}

if(Serial.available())
{
outDat = Serial.read();
Wifi.write(outDat);
}
}

#4

Thanks for the tip, that will help.

So I was wondering about the ‘Connect’ menu in Makeblock. Can you tell me, does the selected interface become the one who’s data will be displayed in the serial monitor? Such that the , device.write data appears there?

If you know or find out that would be great, my Bluetooth Makeblock connect seems to timeout most of the time, so I haven’t worked out serial data transfer.


#5

Honestly, I don’t know (yet). That would be a great question to pose to the support team and @Pioneer.


#6

I just use a Bluefruit EZ-Link - Bluetooth Serial Link & Arduino Programmer - v1.3 connected to the robot’s serial port and Tera Term from the computers BlueTooth serial to a log file which you can also interact with and/or download with and not have to walk over to the robot. https://www.adafruit.com/product/1588


#7