HEXY UART communication


#1

Hello,

I am trying to give hexy UART commands from an Arduino Mega 2560 to its RX port.
Here is my code:

#include <string.h>
#include <stdio.h>
#include "Arduino.h"

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.print("C");
  Serial.print("\n");
  delay(2000);
  Serial.print("#6P1000");
  Serial.print("\n");
  delay(2000);
  Serial.print("#6P2000");
  Serial.print("\n");
  delay(2000);
  Serial.print("C");
  Serial.print("\n");
  delay(2000);
}

Why doesn’t this work? I get no movement from Hexy. Hexy works fine on PoMoCo so no obvious issues. I also have a UART LCD screen and the Mega can print the commands to that as well.


#2

Your syntax is correct. Serial is usually the serial port connected to the USB out. Have you tried other serial ports, and made sure that TX->RX and RX->TX wiring-wise?


#3

Yes everything is wired up correctly. I’m trying to Use the RX pin that hexy uses for the bluetooth module since I know its listening there according to the servotor32 firmware code on github. Any thoughts?


#4

Doesn’t Serial go to the USB on the 2560?
If I am correct you should be able to see your commands print in the debug window with the IDE connected to the 2560.

I suggest using a different serial port on the 2560.

I also suggest that the last 3 statements in your loop are unnecessary since they are duplicates of the first 3.

Good Luck