Posts

Showing posts from December, 2019

Android Studio codes for nodeMCU servo UDP Class

package com.source.myro; import android.os.Message; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.SocketException; import java.net.UnknownHostException; /*import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.net.Socket;*/ public class UdpClientThread extends Thread { String Str ; String dstAddress ; int dstPort ; private boolean running ; MainActivity.UdpClientHandler handler ; DatagramSocket socket ; InetAddress address ; //PrintWriter printWriter; //BufferedReader bufferedReader; public UdpClientThread(String str, String addr, int port, MainActivity.UdpClientHandler handler) { super (); Str = str; dstAddress = addr; dstPort = port; this . handler = handler; } public void setRunning( boolean r...

Android Studio Codes for nodeMCU Servo Main Class

package com.source.myro; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends AppCompatActivity { EditText editTextAddress , editTextPort , editTextMsg ; Button buttonConnect , buttonDisconnect , buttonSend ; TextView textViewState , textViewRx ; UdpClientHandler udpClientHandler ; UdpClientThread udpClientThread ; @Override protected void onCreate(Bundle savedInstanceState) { super .onCreate(savedInstanceState); setContentView(R.layout. activity_main ); editTextAddress = (EditText) findViewById(R.id. address ); editTextPort = (EditText) findViewById(R.id. port ); editTextMsg = (EditText) findViewById(R.id. msgtosend ); buttonConnect = (Button) findViewById(R.id. connect ); ...