Hi everyone !
i create a project with Unity, Teensy 3.1 and his own bluetooth module. In Unity i've got an script that create an two bytes message (one for the pin's number and second for PWM intensity).
So in Update(), i've got create an test fonction
my fonction "TeensyNetWorkBT.analogWrite()" do that :
and my sketch analyse message like that :
However I saw in debug console " Skipping profile frame. Receiver can not keep up with the amount of data send" appears and my Unity app crash ... so i know Teensy have 8 byte FIFO but even if I send per pack of 8 bytes with 0.1 sec wait it's the same problem my app crash after a random time.
anyone can help me ?
thanks for reply
A.
i create a project with Unity, Teensy 3.1 and his own bluetooth module. In Unity i've got an script that create an two bytes message (one for the pin's number and second for PWM intensity).
So in Update(), i've got create an test fonction
Code:
void Update()
{
for (int indiceTab = 0; indiceTab < NbLed; indiceTab++)
{
if ((brightness <= 0 || brightness >= 255))
{
fadeAmount = -fadeAmount;
}
brightness += fadeAmount;
TeensyNetWorkBT.analogWrite(pins[indiceTab], brightness);
}
}
}
my fonction "TeensyNetWorkBT.analogWrite()" do that :
Code:
public static void analogWrite(int pin, int value)
{
byte[] message = new byte[2];
message[0] = (byte)(pin);
message[1] = (byte)(value);
BtConnector.sendBytes(message); //une fois le message composé plus haut on l'envoie
}
and my sketch analyse message like that :
Code:
void setup()
{
Serial1.begin(9600); // ouverture de la connexion
}
void loop()
{
while (Serial1.available())
{
byte inputBytes[2];
for(int n=0; n<2; n++) // on stock l'entrée dans un tableau
{
inputBytes[n] = Serial1.read(); // Then: Get them.
}
analogWrite(inputBytes[0],inputBytes[1]); // ecriture sur le Teensy
}
}
However I saw in debug console " Skipping profile frame. Receiver can not keep up with the amount of data send" appears and my Unity app crash ... so i know Teensy have 8 byte FIFO but even if I send per pack of 8 bytes with 0.1 sec wait it's the same problem my app crash after a random time.
anyone can help me ?
thanks for reply
A.