|
|
@@ -4,6 +4,7 @@ using UnityEngine;
|
|
|
using UnityEngine.UI;
|
|
|
using ArduinoBluetoothAPI;
|
|
|
using DG.Tweening;
|
|
|
+using System.Text;
|
|
|
|
|
|
public class BluetoothShoot : MonoBehaviour
|
|
|
{
|
|
|
@@ -12,7 +13,7 @@ public class BluetoothShoot : MonoBehaviour
|
|
|
BluetoothHelperService bluetoothService;
|
|
|
string deviceName = "";
|
|
|
bool canConnect = true;
|
|
|
-
|
|
|
+ bool bFirstIn = true;
|
|
|
// string targetDeviceName = "BGBox_202012";
|
|
|
string targetDeviceName = "BArrow_202105";
|
|
|
[SerializeField] Text textUI;
|
|
|
@@ -85,6 +86,15 @@ public class BluetoothShoot : MonoBehaviour
|
|
|
bluetoothHelper.OnCharacteristicChanged += (helper, value, characteristic) =>
|
|
|
{
|
|
|
byte[] bytes = value;
|
|
|
+
|
|
|
+ if(bFirstIn)
|
|
|
+ {
|
|
|
+ bFirstIn = false;
|
|
|
+ string s = Encoding.ASCII.GetString(bytes);
|
|
|
+ Debug.Log("value======="+s);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// Log(String.Join(",", bytes));
|
|
|
BluetoothClient.UploadData(1, bytes);
|
|
|
if (ShootCheck.ins != null)
|