This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="#121212" | |
android:orientation="vertical"> | |
<RelativeLayout | |
android:layout_marginTop="60dp" | |
android:layout_width="match_parent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
android:innerRadiusRatio="2.5" | |
android:shape="ring" | |
android:thickness="4dp" | |
android:useLevel="false"> | |
<solid android:color="#b4b4b4"/> | |
<corners | |
android:bottomLeftRadius="60dp" | |
android:bottomRightRadius="60dp" | |
android:topLeftRadius="60dp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<SoftwareSerial.h> | |
#define led D5 | |
SoftwareSerial mySerial(D7,D8); | |
char command; | |
String string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.appcompat.app.AppCompatActivity; | |
import android.app.ProgressDialog; | |
import android.bluetooth.BluetoothAdapter; | |
import android.bluetooth.BluetoothDevice; | |
import android.bluetooth.BluetoothSocket; | |
import android.content.Intent; | |
import android.os.AsyncTask; | |
import android.os.Bundle; | |
import android.util.Log; | |
import android.view.View; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class ConnectBT extends AsyncTask<Void, Void, Void> | |
{ | |
private boolean ConnectSuccess = true; //if it's here, it's almost connected | |
@Override | |
protected void onPreExecute() | |
{ | |
progress = ProgressDialog.show(LedControl.this, "Connecting...", "Please wait!!!"); //show a progress dialog | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void Disconnect() | |
{ | |
if (btSocket!=null) //If the btSocket is busy | |
{ | |
try | |
{ | |
btSocket.close(); //close connection | |
Toast.makeText(getApplicationContext(),"Connection closed successfully",Toast.LENGTH_SHORT).show(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onButton = (Button) findViewById(R.id.onButton); | |
offButton = (Button) findViewById(R.id.offButton); | |
disconnectButton = (Button) findViewById(R.id.disconnectButton); | |
Intent newint = getIntent(); | |
address = newint.getStringExtra("DEVICE_ADDRESS");onButton.setOnClickListener(new View.OnClickListener() | |
{ | |
@Override | |
public void onClick(View v) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BluetoothAdapter myBluetooth = null; | |
BluetoothSocket btSocket = null; | |
Button onButton, offButton, disconnectButton; | |
private ProgressDialog progress; | |
String address=null; | |
static final UUID myUUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); | |
private boolean isBtConnected = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.annotation.Nullable; | |
import androidx.appcompat.app.AppCompatActivity; | |
import android.bluetooth.BluetoothAdapter; | |
import android.bluetooth.BluetoothDevice; | |
import android.content.BroadcastReceiver; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.content.IntentFilter; | |
import android.os.Bundle; | |
import android.util.Log; |