I’m thinking if I use a transistor which is set to stop the connection between a battery and the play/pause switch while the arduino is on. Then trigger a reset with code,
void (*softReset) (void) = 0; //declare reset function @ address 0
softReset();
or
//digitalPin 7 is connected to the RESET pin on Arduino
//NOTE: you CANNOT program the board while they are connected
//by default digitalPin 13 will blink upon reset, so stick an LED in there
int interval = 5000;
long int time = 0;
void setup(){
digitalWrite(7, HIGH); //We need to set it HIGH immediately on boot
pinMode(7,OUTPUT); //We can declare it an output ONLY AFTER it’s HIGH
// (( HACKHACKHACKHACK ))
Serial.begin(9600); //So you can watch the time printed
}
void loop(){
time = millis();
Serial.println(time);
if(time > interval){
Serial.println(“RESET!”);
digitalWrite(7, LOW); //Pulling the RESET pin LOW triggers the reset.
}
}
As the arduino resets the play/pause will be ‘pressed’ electronically and it should flip into record mode when the transistor kicks in again. Maybe with the help of a short delay.
Then when the bottle tips upright again The transistor could flip on and off again quickly to enter play mode.
It’s a long shot I know but it is now 3:52am. Lets hope softReset works.
**************UPDATE**********************
This doesn’t work
Mainly because the record function needs to close the recording. So nothing will record unless recording finishes before the reset. Also the reset does not last long enough to reset the arduino properly.
-
alacritr said:
“D5 - Used for receive signal from switch for Play&Stop and Record function(could be used for your own application if the switch is not used).”
could you write to pin D5 to trigger a record?
-
stuarthooper posted this