A few days ago I was asked by a researcher:

“We want to be able to see how many times the rat turned the wheel one complete revolution.  As the wheel turns it will send a value through the Arduino starting at zero up to 1 and then it flips from 1 right back to zero.  Would there be a way just to count the number of times the input value changes from one to 0 within a phase?
We also want to make sure that value is reported in the exported Excel doc.

No problem!  Checking for when the wheel value goes from 1 back to zero requires an if statement:

Then, we can use the save function to save the data into the database.  We didn’t  need to call it “wheelCount”, we could have called it anything we wanted.  The data saved with this function will automatically be exported into the Excel file for this session.

I hope this helps,

Robert