Re: URGENT! FED protocol only works when attached to computer

44 views
Skip to first unread message

Lex

unread,
Jun 24, 2024, 3:50:14 PM6/24/24
to Renée Poelman, FEDforum
Hi Renée,
A few thoughts that might help:
1) Is the battery low?  Sometimes weird things can happen when the battery voltage is very low, and issues caused by low battery voltage would resolve with USB power connected. Can you make sure the battery is charged?
2) The next thing I would check is if the FED3 library version is the same as the last time you flashed this code and had it working.  If you have a FED3 data file from when this code was working you can check column B to see what library version you were using, and then make sure you're flashing your current code with that same version now:
image.png
3) Given your need to get going I would suggest trying your code on different FEDs, sometimes issues are specific to one FED so if it works on your other FEDs and you can run with one fewer animal that might let you get started.  

Hopefully you find the solution, good luck!  -Lex

On Mon, Jun 24, 2024 at 9:30 AM Renée Poelman <renee....@outlook.com> wrote:
Dear,
!Does anyone know why a FED3 code runs differently when it is attached with the USB cable vs on its own! 
I am running a custom Arduino code for the FED, and since a few days it is not logging part of the code properly anymore. Nothing has been changed in this code, and it has been working correctly before. Everything about the code is working except for creating the 'OFF' label, shown in part of the code below:

After flashing and checking the output of the code on the same FED, I finally found out that when I flashed the FED and it is still attached to the computer with the USB cable, my code is properly working. When I then take it off the cable and re-start it, it is not working as it should.

Screenshot 2024-06-24 162554.png

Does anyone have an idea why the program is running differently when detached from the computer? I need help asap as I have experiments in 15 hours that have been postponed due to this issue which I really can't push back more.
Best,
Renée

--
You received this message because you are subscribed to the Google Groups "FEDforum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fedforum+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fedforum/ef27b8d7-3992-4f78-8752-1c04c03cfe19n%40googlegroups.com.

Christine Liu

unread,
Jun 25, 2024, 7:10:49 AM6/25/24
to FEDforum
I can think of 2 possibilities:

1) Do you have a line in your code that relies on "Serial" ? For example, "while (!Serial) delay(10)" or "if(Serial.available() > 0)". If so, try editing your code to remove that contingency, because the device is needs to connect to the Serial Monitor in the Arduino IDE to for Serial to be true or available.

2) Do you have a random seed to generate your random numbers that is based on the battery pin? Arduino does not actually generate truly random numbers, but rather a fixed psuedo random sequence that is the same every time based on the random seed. One way to improve randomness is to set the random seed to a floating pin since the voltage returned is less likely to be the same. If your random seed is set to the battery pin, the battery voltage is going to read as full when you have the device plugged into the computer vs. when it's on battery. 

Reply all
Reply to author
Forward
0 new messages