arduino-uno


Receiving data automatically in wifi(ESP8266) Even though connected my mobile with ESP8266


Hello friends,
I'm new to arduino. So please help me to solve this issue.
I'm doing android mobile (IR less) control arduino UNO and WIFI (ESP8266) based TV control. I connected my mobile phone wifi with ESP8266 and I'm sending data to ESP8266 to control TV.
But it receives random values and did not receive values whatever I'm sending through my mobile phone wifi (But both wifi has in connection). But before I did controlled. Now I couldn't control I don't know why. And also how to stop this random value reception.
I'm attaching my code here
#include<IRremote.h>
IRsend ir;
char serialA;
void setup()
{
pinMode(3, OUTPUT);
// Serial communication
Serial.begin(115200);
// Wifi commands
Serial.println("AT");
delay(1000);
Serial.println("AT+CIPMUX=1\r\n");
delay(1000);
Serial.println("AT+CIPSERVER=1,80\r\n");
delay(1000);
Serial.end();
}
void loop()
{
delay(800);
Serial.begin(115200);
if (Serial.available() > 0 )
{
serialA = Serial.read();
Serial.println(serialA);
IRREMOTE();
}
}
void IRREMOTE()
{
switch (serialA)
{
case 'A': //Power
ir.sendNEC(0x2FD48B7, 32);
delay(500);
break;
case 'B': // AV/TV
ir.sendNEC(0x2FD28D7, 32);
delay(500);
break;
case 'C': // Mute
ir.sendNEC(0x2FD08F7, 32);
delay(500);
break;
case 'D': // CH+
ir.sendNEC(0x2FDD827, 32);
delay(500);
break;
case 'E': // CH-
ir.sendNEC(0x2FDF807, 32);
delay(500);
break;
case 'F': // Vol+
ir.sendNEC(0x2FD58A7, 32);
delay(500);
break;
case 'G': // Vol-
ir.sendNEC(0x2FD7887, 32);
delay(500);
break;
case 'H':
// Menu
ir.sendNEC(0x2FD30CF, 32);
delay(500);
break;
case 'I':
// Alt
ir.sendNEC(0x2FD708F, 32);
delay(500);
break;
case 'J':
// Scan
ir.sendNEC(0x2FDDA25, 32);
delay(500);
break;
}
}
Thank you
I'm not an expert but you sent
Serial.println("AT");
instead of Serial.println("AT\r\n");.
To initialize the ESP8266 you normally start with a reset so maybe you should add
Serial.println("AT+RST\r\n");
delay(500);
above your AT command.
Furthermore, you start your communication in the setup() and you repeat it in the loop(). The line in the loop() shouldn't be necessary!
Would be nice to see the random values which you received! Maybe I can find the problem (could be something wrong depending on the ASCII table)
try adding Serial.Flush() after every Serial data sent to the ESP

Related Links

if statement in while loop arduino
blinking all led at a time in arduino uno
ESP8266 AT response is OK But Cannot Reset it
How do I make two servo's move in opposite directions?
Sparkfun CAN BUS sheild with arduino UNO
Using Arduino and Motor Shield
AT+CSQ? returns error
Array accessing in arduino and for loop
Bluetooth module won't function when working with leapmotion
switch on or off the motor based on the reply of the user
IS my Modulo usage incorrect? What can
Use analog output as digital in relay pins
Arduino Uno and ESP8266-01
Power supply for raspberry and arduino
Arduino UNO and MPU 6050
Understanding timer choices/options

Categories

HOME
twitter
pypi
comparison
electron
spring-jdbc
callback
wamp
flyway4
azure-media-services
indesign
webrequest
handsontable
nstableview
hapi
dynamics-crm-online
systemc
foselasticabundle
beyondcompare
viewport
clickonce
orleans
mmap
underflow
nhapi
publish
log4js-node
frame
column-family
y86
normal-distribution
android-ble
wixsharp
dartium
streamsets
webix-treetable
user-controls
isbn
termination
theming
logparser
python-webbrowser
aurelia-validation
sqldf
watchconnectivity
gridpane
actionbardrawertoggle
essence
dataview
ipconfig
php-parse-error
system.management
reactive-banana
embedded-code
sankey-diagram
nsight
gwidgets
mdt
qcodo
rdl
php-5.4
yorick
doskey
comexception
industrial
runtime.exec
google-cloud-save
gridcontrol
html4
qt-faststart
enterprisedb
tinn-r
simba
frameset
ticoredatasync
enter
custom-backend
netdna-api
rfc1123
radcombobox
xsdobjectgen
compiler-specific
spec#
scripting-languages

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App