Go Down

Topic: Use RemoteXY for Android communication (Read 32086 times) previous topic - next topic

Barito

Waiting for my Bluetooth module to arrive at the mailbox just to test this app.
There are still exciting applications out there then!

saddys

It is possibile to use input remotexy.button in an array?

RubenMaa

Hey so, Im new to connection between Arduino and Android, and I tried to connect My hc-05 to my android using RemoteXY, with the objective of "driving" a dc motor car, I have the l293d Shield connected directly to the Arduino and I connected the bluetooth module to 7 and 8 pins, (RX and TX) and I connected the VCC to 5V port and GND to GND Port.

When I try to connect to the bluetooth of hc-05 it says this: "socket connect error: read failed,socket might closed or timeout, read ret: -1", I tried to change somethings in my code and nothing worked. Besides that I searched for the problem and nothing appears, Can someone say what it is? And what I have to do? Pls need this for a project for school thank you.


My code:

#define REMOTEXY_MODE__SOFTWARESERIAL
#include <SoftwareSerial.h>

#include <RemoteXY.h>

// RemoteXY connection settings
#define REMOTEXY_SERIAL_RX 8
#define REMOTEXY_SERIAL_TX 7
#define REMOTEXY_SERIAL_SPEED 9600


// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255, 4, 0, 0, 0, 82, 0, 8, 28, 2,
  5, 16, 65, 27, 30, 30, 30, 64, 30, 30,
  31, 25, 2, 2, 1, 3, 3, 23, 12, 2,
  3, 22, 11, 49, 25, 31, 31, 79, 78, 0,
  79, 70, 70, 0, 2, 1, 41, 18, 22, 5,
  21, 54, 22, 5, 2, 26, 16, 31, 82, 0,
  76, 0, 129, 0, 65, 1, 33, 4, 28, 6,
  32, 4, 24, 67, 111, 110, 116, 114, 111, 108,
  111, 32, 82, 101, 109, 111, 116, 111, 0
};

// this structure defines all the variables of your control interface
struct {

  // input variable
  int8_t joystick_1_x; // =-100..100 x-coordinate joystick position
  int8_t joystick_1_y; // =-100..100 y-coordinate joystick position
  uint8_t switch_1; // =1 if switch ON and =0 if OFF
  uint8_t switch_2; // =1 if switch ON and =0 if OFF

  // other variable
  uint8_t connect_flag;  // =1 if wire connected, else =0

} RemoteXY;
#pragma pack(pop)

/////////////////////////////////////////////
//           END RemoteXY include          //
/////////////////////////////////////////////


#include <AFMotor.h>
AF_DCMotor rightMotor(3, MOTOR12_64KHZ);      //Declaração dos 4 motores DC
AF_DCMotor leftMotor(2, MOTOR12_64KHZ);
AF_DCMotor rightMotor1(4, MOTOR12_64KHZ);
AF_DCMotor leftMotor1(1, MOTOR12_64KHZ);


String readString;

void setup()
{
  RemoteXY_Init();


  Serial.begin(9600);
  rightMotor.setSpeed(170);
  leftMotor.setSpeed(170);
  rightMotor1.setSpeed(170);
  leftMotor1.setSpeed(170);

}

void loop()
{
  RemoteXY_Handler();

  while (Serial.available()) {
    delay(50);
    char c = Serial.read();
    readString += c;
  }
  if (readString.length() > 0) {
    Serial.println(readString);
    if (readString == "FORWARD") {
      rightMotor.run (FORWARD);
      leftMotor.run (BACKWARD);
      rightMotor.run(FORWARD);
      leftMotor1.run (FORWARD);
      delay(500);
    }
    if (readString == "BACKWARD") {
      rightMotor.run (BACKWARD);
      leftMotor.run (FORWARD);
      rightMotor1.run (BACKWARD);
      leftMotor1.run (BACKWARD);
      delay(500);
    }
    if (readString == "LEFT") {
      leftMotor.run(BACKWARD);
      rightMotor.run(FORWARD);
      leftMotor1.run(BACKWARD);
      rightMotor1.run(FORWARD);
      delay(500);
    }
    if (readString == "RIGHT") {
      leftMotor.run(BACKWARD);
      rightMotor.run(BACKWARD);
      leftMotor1.run(FORWARD);
      rightMotor1.run(BACKWARD);
      delay(500);
    }
    if (readString == "STOP") {
      leftMotor.run(RELEASE);      //Desliga os motores
      rightMotor.run(RELEASE);
      leftMotor1.run(RELEASE);
      rightMotor1.run(RELEASE);
      delay(500);
    }

    readString = "";
  }
}

ZAKARIATOUIL

hi bro Can you use remotxy server cloud with webhook to connect with google assistant

hellojoseph1

#64
May 19, 2019, 01:16 am Last Edit: May 20, 2019, 05:13 am by hellojoseph1
Hello Genius Shev,

Q1) can i run same ((same project )) on two DIFFERENT cell phones at same time?
example >> i create one single simple remotexy project to read home temperature and both me and my wife have access to it at same time?  >>>> i tried but 2nd device does not connect unlessi close 1st cell phone says"Device already used by another app" .. why not multi instances?

Q2) CAN ((1 PROJECT )) communicate with two MCU devices at same time?
example>> i build one remotexy project to read two temperature from two different rooms by two different arduino devices but both report at same remote xy? possible?

Q3) i am using Edit field as a password so i need it to either shown as **** or cleared after few second.. how can i clear it ""automatically"" without press on X mark ?

thank you creating this app Sir

Go Up