Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Won't receive COM messages #43

Closed
Vortex070 opened this issue Jun 15, 2020 · 6 comments
Closed

Won't receive COM messages #43

Vortex070 opened this issue Jun 15, 2020 · 6 comments

Comments

@Vortex070
Copy link

I have a custom Arduino script that will not display any messages at all in Unity using the plugin. It will display that the device is connected and, in docklight, I am receiving messages. I've wondered into the code and the inputQueue will appear as null (meaning no messages are being received).

the following is my Arduino Code:


//player 2 commented out for single wheel
int p1Pin = 0; //player 1 potentiometer
//int p2Pin = 1;//player 2 potentiometer
int p1Val = 0;
//int p2Val = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
p1Val = analogRead(p1Pin);
//p2Val = analogRead(p2Pin);
Serial.print("P1 Raw Val: ");
Serial.println(p1Val);
p1Val = map(p1Val, 305, 853, 0, 100);
Serial.print("P1 Mapped Val: ");
Serial.println(p1Val);
/*Serial.print("P2 Raw Val: ");
Serial.println(p2Val);
p1Val = map(p2Val, 305, 853, 0, 100);
Serial.print("P2 Mapped Val: ");
Serial.println(p2Val); */
delay(5);
}

@dwilches dwilches changed the title Won't reieve COM messages Won't receive COM messages Jun 16, 2020
@dwilches
Copy link
Owner

Hello,

Have you tried the sample Arduino code provided with Ardity? It's at the bottom of this page.
If that code works with your Arduino, then you can use it to debug your other code.

Regards.

@KaiKruschel
Copy link

KaiKruschel commented Jul 8, 2020

Hi,
I have the same problem. I open the DemoScene_AutoPoll in Unity while your example Sketch is running on an Arduino Yùn. The Arduino serial monitor gets the heartbeat messages.
The console in Unity prints "Connection established" and nothing more. This is Unity Version 2019.4.0f1 on Mac OS. The API compatibility Level is set to .Net Standard 2.0. But the same behaviour occurs on .Net 4.x. Do you have any ideas, what this could be?

@Vortex070
Copy link
Author

Vortex070 commented Jul 8, 2020 via email

@KaiKruschel
Copy link

I tried to get the example autopoll scene to run with the arduino test code since that already has a message listener. On Mac OS I get a connection message but none of the following messages. If I use the arduino serial monitor it works fine. Strangely enough if I use the same code on a windows machine, it works without problem. Will look into this further and update here when I find the time.

Thanks for the help

@KaiKruschel
Copy link

Just a quick update: I set Dtr and Rts to true manually for the port in the AttemptConnection Method of the AbstractSerialThread Class. A quick test shows that setting either of them works just as well.
@Vortex070 Docklight seems to be Windows only unfortunately

@dwilches
Copy link
Owner

Hello,
Thanks for the information, I'll update the package to include configuration for both flags then.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants