FEDSync is software designed to control the FED3 Unit over a serial connection
For Linux you will need to download and run the python source code. Python Modules needed
pyqt5
pySerial
Windows has a bundled executable which can be downloaded from releases.
A custom library for the FED3 device is currently required. (being added to main library)
#include "RTClib.h"
Then we will modify the setup
function to enable the serial functions
void setup() {
...
fed3.disableSleep();
fed3.SerialLogging = true;
Serial.begin(57600);
}
Adding a function to parse commands sent by FEDSync
void parse_command() {
while(Serial.available()) {
String command = Serial.readStringUntil('\0');
if(command == "Reset"){
fed3.rest_vars();
} else if(command == "Headers") {
fed3.sendHeaders();
} else if(command == "Time") {
char time[100];
Serial.readStringUntil('\0').toCharArray(time, 99);
rtc.adjust(DateTime(time));
Serial.print(time);
Serial.write((byte)0);
} else {
Serial.print(command);
Serial.write((byte)0);
}
}
}
Before we decalre loop
we are going to add a boolean that will to wait for the fed device to be used.
bool started = false;
void loop() {...
Lastly modify the loop
to wait for a left poke before starting the device, this will let us talk to the device before we start the experiment
void loop() {
while(!started) {
parse_command();
if(fed3.Left) started = true;
}
...