Hi guys, i want to create an android app that can receive data of a sensor that i've already connected with Arduino Yun. Can you help me to write a code that can send data to android via wifi because i tried to do this but it doesnt work ....
![]()
I wrote something but it's not correct.
#include <SPI.h>
#include <WiFi.h>
WiFiServer server (80);
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
server.begin();
}
// the loop routine runs over and over again forever:
void loop() {
WiFiClient client = server.available();
while (client.connected()) {
if (client.available()) {
char c = client.read();
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
client.print(sensorValue);
delay(1000); } // delay in between reads for stability
}
}