Skip to content
This repository has been archived by the owner on Aug 21, 2021. It is now read-only.

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
maxim-perumal committed Dec 2, 2017
1 parent e7d12a3 commit aace252
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 35 deletions.
37 changes: 6 additions & 31 deletions Arduino/Arduino.ino
Original file line number Diff line number Diff line change
@@ -1,28 +1,5 @@
/*
MIT License
Copyright (c) 2017 Maxime Coutte Peroumal Corne
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/


// This simple code allow you to send data from Arduino to Unity3D.

// uncomment "NATIVE_USB" if you're using ARM CPU (Arduino DUE, Arduino M0, ..)
#define NATIVE_USB

Expand All @@ -39,22 +16,20 @@ void setup() {
Serial.begin(250000); // You can choose any baudrate, just need to also change it in Unity.
while (!Serial); // wait for Leonardo enumeration, others continue immediately
#endif


}

// Run forever
void loop() {
sendData("Hello World!");
delay(5);
delay(5); // Choose your delay having in mind your ReadTimeout in Unity3D
}

void sendData(String data){
#ifdef NATIVE_USB
SerialUSB.println(data); // need a end-line
SerialUSB.println(data); // need a end-line because wrmlh.csharp use readLine method to receive data
#endif

#ifdef SERIAL_USB
Serial.println(data); // need a end-line
Serial.println(data); // need a end-line because wrmlh.csharp use readLine method to receive data
#endif
}

2 changes: 1 addition & 1 deletion Assets/WRMHL/Scripts/Manager/wrmhl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System.Collections.Generic;
using UnityEngine;

// This class allow you to establish the connection between your device and Unity by setting-up Thread.
// This class allow you to establish the connection between your device and Unity by setting-up Thread and manage these Thread.
public class wrmhl {

// ========================================================================================
Expand Down
16 changes: 15 additions & 1 deletion Assets/WRMHL/Scripts/wrmhlRead.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@
using System.Collections.Generic;
using UnityEngine;

// This script is used to read the data coming from the device.
/*
This script is used to read all the data coming from the device. For instance,
If arduino send ->
{"1",
"2",
"3",}
readQueue() will return ->
"1", for the first call
"2", for the second call
"3", for the thirst call
This is the perfect script for integration that need to avoid data loose.
If you need speed and low latency take a look to wrmhlReadLatest.
*/

public class wrmhlRead : MonoBehaviour {

wrmhl myDevice = new wrmhl(); // wrmhl is the bridge beetwen your computer and hardware.
Expand Down
14 changes: 13 additions & 1 deletion Assets/WRMHL/Scripts/wrmhlReadLatest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@
using System.Collections.Generic;
using UnityEngine;

// This script is used to read the data coming from the device.
/*
This script is used to read the latest data coming from the device. For instance,
If arduino send ->
{"1",
"2",
"3",}
readLatest() will return ->
"3"
This is the perfect script for integration that need speed and low latency.
If you need to avoid data loose take a look to wrmhlRead.
*/

public class wrmhlReadLatest : MonoBehaviour {

wrmhl myDevice = new wrmhl(); // wrmhl is the bridge beetwen your computer and hardware.
Expand Down
Binary file modified ProjectSettings/DynamicsManager.asset
Binary file not shown.
Binary file modified ProjectSettings/Physics2DSettings.asset
Binary file not shown.
2 changes: 1 addition & 1 deletion ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
m_EditorVersion: 5.6.3p2
m_EditorVersion: 2017.2.0f3
4 changes: 4 additions & 0 deletions UnityPackageManager/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"dependencies": {
}
}

0 comments on commit aace252

Please sign in to comment.