1

Topic: Arduino input statuses on the phone screen as the led is on or off

First of all, thank you for creating such a platform. I would like you to help me with something. I'm new to Arduino and trying to learn.  I'm using Arduino Nano. I want to see the status of any entry over the phone, but I can't. As an example, I want to see it with LED on the 4-input phone screen. (turn on led turn on, turn off when off)

I would be very grateful if you could write a short code example. I'm writing from your examples, but I'm getting an error. I would appreciate it if you write and send the full code in the form of Arduino Nano + wifi Module+1 output+1 input.


Thank you

2

Re: Arduino input statuses on the phone screen as the led is on or off

kzekih wrote:

I'm writing from your examples, but I'm getting an error

Hello, this forum is here to assist you, not write your code for you smile 

Perhaps we can figure out what error you are getting and assist with that?

"And voila, which is French for.......'and then I found out.'" - Ready Player One

3

Re: Arduino input statuses on the phone screen as the led is on or off

My code is this. Can you tell me what's the wrong in this code.

RemoteXY include library          //
//////////////////////////////////////////////

// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__ESP8266_HARDSERIAL_CLOUD

#include <RemoteXY.h>

// RemoteXY connection settings
#define REMOTEXY_SERIAL Serial
#define REMOTEXY_SERIAL_SPEED 9600
#define REMOTEXY_WIFI_SSID "AirTies_Air5650-1"
#define REMOTEXY_WIFI_PASSWORD "kzekih102030"
#define REMOTEXY_CLOUD_SERVER "cloud.remotexy.com"
#define REMOTEXY_CLOUD_PORT 6376
#define REMOTEXY_CLOUD_TOKEN "4644ff9d2ef7698939217c10191b3a4b"


// RemoteXY configurate 
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
  { 255,1,0,25,0,95,0,13,158,1,
  70,24,32,20,18,18,48,36,2,1,
  0,33,45,18,18,2,31,88,0,129,
  0,46,87,9,2,22,68,105,122,97,
  121,110,32,75,90,0,66,0,8,5,
  4,40,2,26,66,64,8,45,4,45,
  2,26,129,0,16,66,13,5,17,73,
  83,73,0,129,0,16,10,12,5,17,
  78,69,77,0,67,4,16,15,20,5,
  2,26,11,67,4,16,73,20,5,2,
  26,11 };
 
// this structure defines all the variables and events of your control interface
struct {

    // input variables
  uint8_t button_1; // =1 if button pressed, else =0

    // output variables
  uint8_t led_1; // led state 0 .. 1
  int8_t level_1; // =0..100 level position
  int8_t level_2; // =0..100 level position
  char text_1[11];  // string UTF8 end zero
  char text_2[11];  // string UTF8 end zero

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

} RemoteXY;
#pragma pack(pop)

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

#define PIN_BUTTON_1 5


void setup()
{
  RemoteXY_Init ();
 
  pinMode (PIN_BUTTON_1, OUTPUT);
 
  if (digitalRead(5) == HIGH) // if pin 5 enjoyed a high level voltage
    RemoteXY.led_1= 255;   // then turn on red light
  else                        // else
    RemoteXY.led_1= 0;     // turn off red
   
  // TODO you setup code
 
}

void loop()
{
  RemoteXY_Handler ();
 
  digitalWrite(PIN_BUTTON_1, (RemoteXY.button_1==0)?LOW:HIGH);
 
  // TODO you loop code
  // use the RemoteXY structure for data transfer
  // do not call delay()

4 (edited by Gunner 2021-08-27 19:13:54)

Re: Arduino input statuses on the phone screen as the led is on or off

When posting code in this forum, please properly format it by placing the code in between the markers as shown when clicking the <> icon in the topic/post editor

kzekih wrote:

 
  if (digitalRead(5) == HIGH) // if pin 5 enjoyed a high level voltage
    RemoteXY.led_1= 255;   // then turn on red light
  else                        // else
    RemoteXY.led_1= 0;     // turn off red

To start... this should be in the void loop() not the void setup () else it only runs once on boot

AND it is not properly written/formatted with brackets {} so it would give a compiling error in the first place.

  
if (digitalRead(5) == HIGH) {  // if pin 5 enjoyed a high level voltage
    RemoteXY.led_1 = 255;  // then turn on red light
 } else {   // else
    RemoteXY.led_1 = 0;  // turn off red
}
"And voila, which is French for.......'and then I found out.'" - Ready Player One