Hi! I want to make my rgb 4 pin led strip controlable by phone by wifi connection. I made a program that allows me to turn it rainbow and turn off. But i want albo to make it white when switch is on and rainbow when another switch is on. But when i send it on arduino uno it says that the program succesfully sent but when i try to connect on phone it tell me that arduno don't give any reply. Here's code:
/*
-- New project --
This source code of graphical user interface
has been generated automatically by RemoteXY editor.
To compile this code using RemoteXY library 2.4.3 or later version
download by link http://remotexy.com/en/library/
To connect using RemoteXY mobile app by link http://remotexy.com/en/download/
- for ANDROID 4.3.1 or later version;
- for iOS 1.3.5 or later version;
This source code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
*/
int rVal = 254;
int gVal = 1;
int bVal = 127;
int rDir = -1;
int gDir = 1;
int bDir = -1;
// constants to name the pins
const int rPin = 11;
const int gPin = 10;
const int bPin = 9;
bool led;
bool white;
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__ESP8266_HARDSERIAL_POINT
#include <RemoteXY.h>
// RemoteXY connection settings
#define REMOTEXY_SERIAL Serial
#define REMOTEXY_SERIAL_SPEED 115200
#define REMOTEXY_WIFI_SSID "Arduino_LED"
#define REMOTEXY_WIFI_PASSWORD ""
#define REMOTEXY_SERVER_PORT 6377
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255,2,0,0,0,71,0,8,25,1,
129,0,1,3,30,7,16,76,69,68,
89,32,80,67,0,2,1,34,1,27,
9,25,24,135,1,79,78,0,79,70,
70,0,129,0,1,14,30,5,16,76,
69,68,89,32,66,73,65,197,129,69,
0,2,1,34,11,27,10,25,24,121,
1,79,78,0,79,70,70,0 };
// this structure defines all the variables of your control interface
struct {
// input variable
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)
#define PIN_SWITCH_1 7
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
void setup()
{
RemoteXY_Init ();
pinMode (PIN_SWITCH_1, OUTPUT);
// TODO you setup code
pinMode(rPin, OUTPUT);
pinMode(gPin, OUTPUT);
pinMode(bPin, OUTPUT);
Serial.begin(9600);
}
void loop()
{
RemoteXY_Handler ();
if (RemoteXY.switch_1!=0){
led = true;
}
delay(10);
while (led = false){
digitalWrite(PIN_SWITCH_1, HIGH);
analogWrite(rPin, rVal);
analogWrite(gPin, gVal);
analogWrite(bPin, bVal);
// change the values of the LEDs
rVal = rVal + rDir;
gVal = gVal + gDir;
bVal = bVal + bDir;
// for each color, change direction if
// you reached 0 or 255
if (rVal >= 255 || rVal <= 0) {
rDir = rDir * -1;
}
if (gVal >= 255 || gVal <= 0) {
gDir = gDir * -1;
}
if (bVal >= 255 || bVal <= 0) {
bDir = bDir * -1;
}
}
while (white = false){
digitalWrite(PIN_SWITCH_1, HIGH);
}
}
What's wrong in this code?