I am in need of programming help for a neuroscience experiment.
So I am going to be using a device that uses javascript coding. The device has EEG sensors and every 30 seconds (one epoch) it calls for NewEpochReceived function. If the condition is satisfied (isREM == true) it then runs a set of commands, including presenting lights at a specific pattern. In the example below it presents 10 x light flashes (1s on, 1 s off) at 50% light intensity.
What I would like to change is that everytime the function is called (every 30s) and condition isREM == true, the light_intensity increases by 5 (after it presents light at 50% intensity initially), until it reaches 100. I also want it to initiate some form of wait function so that after light pattern is presented there is a 60 second stop to presenting any lights. But trick is I still want the ZMax_Toast code bit to run and the loop to keep working every 30 seconds.
Really appreciate your input on this, my programmign skills are severely lacking.
//ZMax_FlashLEDS("white", 100, 1, 5, 5, 1, 0);
//Parameters are color, intensity [0..100], ontime [0..255] * 100ms, offtime [0..255] * 100ms,
//reps [0..255], vibrate [0 or 1], alternateEyes [0 or 1]
// ***********************************************************
// NewEpochReceived
// ----------------------------------------------------------
// called every epoch (30 seconds)
// ***********************************************************
function NewEpochReceived(nEpoch, dxyz, isREM)
{
if (isREM == true) //enable_rem_detection must be true
{
ZMax_Toast("Epoch " + nEpoch + " is REM!", "#009900");
var vibration = 0;
var alternate_eyes = 0;
var light_intensity = 50;
var ontime = 10;
var offtime = 10;
var reps = 10;
ZMax_FlashLEDS ("white", light_intensity, ontime, offtime, reps, vibration, alternate_eyes)
}
}
Aucun commentaire:
Enregistrer un commentaire