I cant Receive and work with data wich is sened by Unity over Wifi to my ESP8266

Create issue
Issue #35 new
Former user created an issue

Hi Marc,

I need your help <- I can't get the Data wich is sended by Unity to work with it. That means:

I send data with KeyboardArrow. Arrow UP is =1 Arrow Down is 2 and so on. If i dont press anything than the number 5 is Sended all the time. I do this with this Code: in start funktion is the board defined:

board = UduinoManager.Instance.GetBoard("ESP8266TamerBoard");

And the sendig Code is this bellow: "UduinoManager.Instance.sendCommand(board,"1"); "

I can see the Numbers in the last send Message Fram in Unity. And in the Serial Monitor i was able to see the numbers after i added this Code to the Start Funktion of the NodeMCU: uduino.useSerial(true);

That means Unity does everything right i think. Iam able to see last message and teh SerialMonitor of the NodeMcu show teh correct number!

But i cant work with the seen Number in don’t know why!

I tried it this following way to just debug it but no chance: //CODE ON NODEMCU: int switchCaseNumber; void getDataTest() { if (softwareSerial.available()) //I tried this with softwareSerial aswell { switchCaseNumber = Serial.read();

switch (switchCaseNumber)
{
  case '1':  Serial.println("The nummber 1 arrived us");  break;        //just to see if when press the Key Arrow UP if it works but no it don’t;
  case '2':    Serial.println("Die Zahl 2 Kam an");   break;
  case '3':    Serial.println("Die Zahl 3 Kam an");   break;
  case '4':   Serial.println("Die Zahl 4 Kam an");   break;
  case '5':   Serial.println("Die Zahl 5 Kam an");    break;
  default:  Serial.println("no number arrives");
    Serial.println("this number arrives us :");
    Serial.write(switchCaseNumber );        // I tried it with Serial.print() too
    Serial.println("================================");
    break;
}

} } But am I doing wrong? Software Serial sends and receives data from Arduino without any problems but not from Unity.

Comments (0)

  1. Log in to comment