Answer the question
In order to leave comments, you need to log in
How to connect android application written in Xamarin Forms and ESP8266?
I will describe as briefly as possible.
We have a project called the WindyBox, a conventional mobile, battery-powered smoke extractor that is needed to filter out harmful substances generated during soldering.
This device consists of a cooler and a case. This cooler will be regulated, as I understand it, by a transistor, but the transistor will be regulated by a PWM created by ESP8266.
There is an application, here it is , and I need to somehow link it to the ESP8266.
I have an ESP8266 like this.
I don’t understand at all how to coordinate the work of the ESP8266 and the application.
Personally, I'm interested in how to program an application so that it can work in harmony with the ESP8266.
I have already dug something in the internet and realized that all this, apparently, should work in the server-client mode.
I have a code here that raises a lot of questions, it is from this site
, here it is.
using System.Net.Sockets;
using System;
namespace TCPIP
{
internal class Program
{
static void Main(string[] args)
{
TcpListener ServerSocket = new TcpListener(8888);
int requestCount = 0;
TcpClient clientSocket = default(TcpClient);
ServerSocket.Start();
Console.WriteLine(">> Server Started");
clientSocket = ServerSocket.AcceptTcpClient();
Console.WriteLine(">> Accept connection from client");
requestCount = 0;
while (true)
{
try
{
requestCount++;
NetworkStream networkStream = clientSocket.GetStream();
byte[] bytesFrom = new byte[10025];
networkStream.Read(bytesFrom, 0, (int)clientSocket.ReceiveBufferSize);
string dataFromClient = System.Text.Encoding.ASCII.GetString(bytesFrom);
dataFromClient = dataFromClient.Substring(0, dataFromClient.IndexOf("$"));
Console.WriteLine(">> Data fromClient - " + dataFromClient);
string serverResponce = "Last message from client " + dataFromClient;
Byte[] sendBytes = System.Text.Encoding.ASCII.GetBytes(serverResponce);
networkStream.Write(sendBytes, 0, sendBytes.Length);
networkStream.Flush();
Console.WriteLine(">> " + serverResponce);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
}
clientSocket.Close();//с этого участка кода всё красное.
ServerSocket.Stop();
Console.WriteLine(">> exit");
Console.ReadLine();
}
}
Answer the question
In order to leave comments, you need to log in
перед тем как браться за подвиги убедись что ты в сказке(с)
вначале выучи C#, а потом уже пытайся что-то на нем писать.
документация по железке тут
ESP8266 это микроконтроллер с wifi модулем, на нем можно поднять http "сервер" и обмениваться данными как с любым другим веб сервером. примеры реализации
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question