i had used other apps to check if my phone is recivieng data, and it shows it, but still, no results from APDE. There is my code with ketai library. Am i missing something? (Edit UGH, i dont know how to format this properly D:)
import ketai.net.bluetooth.*;
String device_name = "BT04-A";
String Str;
KetaiBluetooth bt;
int x; // zmienna osi x (pin A0)
int y; // zmienna osi y (pin A1)
PFont f; // zmienna czcionki
String portName;
void setup()
{
fullScreen(); // rozmiar okna
orientation(PORTRAIT);
bt.getPairedDeviceNames();
bt.connectToDeviceByName(device_name);
bt.start();
f = createFont("Arial", 16, true); // Arial, 16px, anti-aliasing
textFont(f, 16); // rozmiar 16px
}
// pętla rysująca
void draw()
{
fill(0); // ustawiamy kolor wypełnienia na czarny
clear(); // czyścimy ekran
fill(255); // ustawiamy kolor wypełnienia na biały
// rysujemy okrąg o określonych współrzędnych
ellipse(x, 1024-y, 10, 10);
// wyświetlamy dane
text("AnalogX="+(1023-x)+" AnalogY="+(1023-y),10,20);
}
void onBluetoothDataEvent(String who, byte[] data) {
String Str = new String(data);
if (Str != null)
{
// rozbijamy odczyt po przecinku i nowej linii
int[] vals = int(splitTokens(Str, ","));
// przypisujemy do zmiennych
x = vals[0];
y = vals[1];
}}