Permalink
Browse files

Added option to output to Arduino devices.

  • Loading branch information...
IAmCoder committed May 31, 2014
1 parent ef9a2f9 commit 2378da40bece5f4f542812e6da3adb0e24e05baf
@@ -153,6 +153,12 @@
}
"Entry"
{
"MsmKey" = "8:_5223C9F4CEC75008D3F4F65D8FFF3E71"
"OwnerKey" = "8:_D5F4677254244E92ACAD2F83F55F5016"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_5301F5D8D26749F7BD0244DEDE118EB5"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
@@ -436,6 +442,12 @@
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_5223C9F4CEC75008D3F4F65D8FFF3E71"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_1FBA81496A2EC06B3748DE845685909D"
"MsmSig" = "8:_UNDEFINED"
}
@@ -1072,6 +1084,37 @@
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_5223C9F4CEC75008D3F4F65D8FFF3E71"
{
"AssemblyRegister" = "3:1"
"AssemblyIsInGAC" = "11:FALSE"
"AssemblyAsmDisplayName" = "8:YocoWrapper, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86"
"ScatterAssemblies"
{
"_5223C9F4CEC75008D3F4F65D8FFF3E71"
{
"Name" = "8:YocoWrapper.dll"
"Attributes" = "3:512"
}
}
"SourcePath" = "8:YocoWrapper.dll"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_491A001224CF4D699EA475B2FB5F2890"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Vital" = "11:TRUE"
"ReadOnly" = "11:FALSE"
"Hidden" = "11:FALSE"
"System" = "11:FALSE"
"Permanent" = "11:FALSE"
"SharedLegacy" = "11:FALSE"
"PackageAs" = "3:1"
"Register" = "3:1"
"Exclude" = "11:FALSE"
"IsDependency" = "11:TRUE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_5301F5D8D26749F7BD0244DEDE118EB5"
{
"SourcePath" = "8:..\\ThinkGear EEG\\Plugins\\Blink Strength.lsd"
@@ -2210,14 +2253,14 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Lucid Scribe ThinkGear EEG"
"ProductCode" = "8:{B7BBD380-8DDD-47CF-A45A-231978ABAEAB}"
"PackageCode" = "8:{FAAFE6AF-2450-4A43-BCFD-11E3D8025E2F}"
"ProductCode" = "8:{AD588752-24B4-4FF8-92DB-3A96431C2BD7}"
"PackageCode" = "8:{49CBC5A2-6456-439A-A754-549FA5AA117E}"
"UpgradeCode" = "8:{9B1E2A82-9D73-4675-9717-2311206ABC4E}"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:TRUE"
"ProductVersion" = "8:1.1.0"
"ProductVersion" = "8:1.1.1"
"Manufacturer" = "8:lucidcode"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:http://www.lucidcode.com/Contact"
BIN +0 Bytes (100%) Lucid Scribe - ThinkGear EEG.suo
Binary file not shown.
@@ -43,12 +43,21 @@ public static class Device
private static bool ClearHighscore;
private static double DisplayValue;
private static double HighscoreValue;

public static Boolean TCMP = false;
public static Boolean NZT48 = false;

public static Boolean tACS = false;
public static String Target = "ANY";
public static String StateOn = "A";
public static String StateOff = "A";

public static Boolean Arduino = false;
public static String ArduinoPort = "COM1";
public static String ArduinoDelay = "1";
public static String ArduinoOn = "1";
public static String ArduinoOff = "0";

public static Boolean REMDetected = false;

public static EventHandler<ThinkGearChangedEventArgs> ThinkGearChanged;
@@ -71,13 +80,21 @@ public static Boolean Initialize()
_thinkGearWrapper.EnableBlinkDetection(true);
Algorithm = formPort.Algorithm;
Threshold = formPort.Threshold;

TCMP = formPort.TCMP;
NZT48 = formPort.NZT48;

tACS = formPort.tACS;
Target = formPort.Target;
StateOn = formPort.StateOn;
StateOff = formPort.StateOff;

Arduino = formPort.Arduino;
ArduinoPort = formPort.ArduinoPort;
ArduinoDelay = formPort.ArduinoDelay;
ArduinoOn = formPort.ArduinoOn;
ArduinoOff = formPort.ArduinoOff;

m_boolInitialized = true;
}
else
@@ -413,6 +430,7 @@ namespace RapidEyeMovement
{
public class PluginHandler : lucidcode.LucidScribe.Interface.LucidPluginBase
{
Thread ArduinoThread;
List<int> m_arrHistory = new List<int>();
public override string Name
{
@@ -555,6 +573,14 @@ public override double Value
{ }
}

// Check if we need to send a message to an arduino
if (Device.Arduino)
{
Device.Arduino = false; // Set false so we don't call it again before the thread completes / after the delay
ArduinoThread = new Thread(TriggerArduino);
ArduinoThread.Start();
}

Device.REMDetected = true;
return 888;
}
@@ -630,6 +656,26 @@ public override double Value
return 0;
}
}

private void TriggerArduino()
{
SerialPort arduinoPort = new SerialPort();
arduinoPort.PortName = Device.ArduinoPort;
arduinoPort.BaudRate = 9600;
arduinoPort.Open();

arduinoPort.Write(Device.ArduinoOn);

int arduinoDelay = Convert.ToInt32(Device.ArduinoDelay) * 60000;
Thread.Sleep(arduinoDelay);

arduinoPort.Write(Device.ArduinoOff);

arduinoPort.Close();
arduinoPort.Dispose();

Device.Arduino = true;
}
}
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 2378da4

Please sign in to comment.