Hi,
I have a battery powered device that enters sleep mode after an initial calibration routine. It then comes out of sleep when data collection begins with a push of a button. Upon completion of collection, it enters sleep again. I am doing this since this project is going to people to use and worried they might forget to turn it off and will drain the batteries (population is +60 that have had strokes), so changing batteries etc is not ideal. So, my problem is that another lab is in charge of the device and before sending it home with the subject they need to get calibration values via the serial port and also update the code for each subject. With it going to sleep, I lose the usb connection. I can upload the code by pushing the button on the device, but would rather make it easier for the other people....so a short story long, is there a way to indicate that the USB is plugged in (meaning they need to update code and don't want it to sleep). I was thinking of just reading VUSB, but it can be over 5V and could use a simple resistor divider (what is digital pin high low levels?), however wondering if there is some other code that I can use to indicate usb is connected.
Sorry for the rambling, just wanted to explain reason for why I want it to work this way. Any help or suggestions would be appreciated.
I have a battery powered device that enters sleep mode after an initial calibration routine. It then comes out of sleep when data collection begins with a push of a button. Upon completion of collection, it enters sleep again. I am doing this since this project is going to people to use and worried they might forget to turn it off and will drain the batteries (population is +60 that have had strokes), so changing batteries etc is not ideal. So, my problem is that another lab is in charge of the device and before sending it home with the subject they need to get calibration values via the serial port and also update the code for each subject. With it going to sleep, I lose the usb connection. I can upload the code by pushing the button on the device, but would rather make it easier for the other people....so a short story long, is there a way to indicate that the USB is plugged in (meaning they need to update code and don't want it to sleep). I was thinking of just reading VUSB, but it can be over 5V and could use a simple resistor divider (what is digital pin high low levels?), however wondering if there is some other code that I can use to indicate usb is connected.
Sorry for the rambling, just wanted to explain reason for why I want it to work this way. Any help or suggestions would be appreciated.