Arduino MEGA ,with HM-10 bluetooth connecting to iphone.
I have the “arduinoblue” setup connecting with any problem from hardware serial2 port
#include <ArduinoBlue.h>
const unsigned long BAUD_RATE = 9600;
int prevThrottle = 49;
int prevSteering = 49;
int throttle, steering, sliderVal, button, sliderId;
// See: https://www.arduino.cc/reference/en/language/functions/communication/serial/
ArduinoBlue phone(Serial2);
// Setup code runs once after program starts.
void setup() {
// Start serial communications.
// The baud rate must be the same for both serials.
Serial.begin(BAUD_RATE);
Serial2.begin(BAUD_RATE);
delay(100);
Serial.println("setup complete");
I have problem connecting to blynk with the code below, what i may be doing wrong?
#define BLYNK_PRINT Serial
#include <BlynkSimpleSerialBLE.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "HRbgs53z9956PosfEmezwGtY6zLZCNw0";
BLYNK_WRITE(V1) {
int x = param[0].asInt();
int y = param[1].asInt();
// Do something with x and y
Serial.print("X = ");
Serial.print(x);
Serial.print("; Y = ");
Serial.println(y);
}
void setup()
{
// Debug console
Serial.begin(9600);
Serial2.begin(9600);
Blynk.begin(Serial2, auth);
Serial.println("Waiting for connections...");
}
void loop()
{
Blynk.run();
}
I am using the ios app Blynk.
Also a working hardware serial example on mega will help a lot. Thanks in advance.
01:03:55.792 -> ___ __ __
01:03:55.792 -> / _ )/ /_ _____ / /__
01:03:55.828 -> / _ / / // / _ / '/
01:03:55.861 -> ///_, /////_
01:03:55.895 -> /__/ v0.6.1 on Arduino Mega
01:03:55.930 ->
01:03:55.930 -> [90] Connecting…
01:03:59.012 -> [3191] Login timeout
01:04:01.025 -> [5191] Connecting…
01:04:04.154 -> [8272] Login timeout
01:04:06.169 -> [10272] Connecting…
01:04:07.892 -> [11976] Packet too big: 19535
01:04:11.283 -> [15353] Connecting…
01:04:16.388 -> [20434] Connecting…
01:04:19.481 -> [23515] Login timeout
01:04:21.509 -> [25515] Connecting…
01:04:26.628 -> [30595] Connecting…
01:04:26.730 -> [30674] Packet too big: 22337
01:04:31.745 -> [35675] Connecting…
01:04:36.853 -> [40756] Connecting…
01:04:39.963 -> [43837] Login timeout
01:04:41.977 -> [45837] Connecting…
01:04:45.095 -> [48918] Login timeout
01:04:47.110 -> [50918] Connecting…
01:04:50.197 -> [53999] Login timeout
01:04:52.220 -> [55999] Connecting…
managed to get something from serial monitor. Packet too big ???
any ideas?