Last active
August 19, 2019 10:13
-
-
Save comoc/edcff880d723822e0c8c57cc5aa5e2f5 to your computer and use it in GitHub Desktop.
UnityからArduinoのデータをシリアル経由で取得したい!確かにArduinoからは出力しているはずなのに何もやって来ない。そんな時の対策 ref: https://qiita.com/comocc/items/43794313413091f23368
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Serial.print("Hello"); | |
| Serial.println(""); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| serialPort_ = new SerialPort(portName, baudRate, Parity.None, 8, StopBits.One); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| serialPort_.ReadTimeout = 1000; // 1000は適当な値です |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void setup() { | |
| Serial.begin(9600); | |
| } | |
| void loop() { | |
| Serial.print("Hello"); | |
| // Serial.println(""); | |
| Serial.println(); // Unity 2019.2.0f1 で確認したら、引数無しでないと動かなかった | |
| delay(1000); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Serial.print("Hello"); | |
| Serial.println(""); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment