I have a arduino nano that I created a small program for. when a button is pushed the following sequence starts:
play sound at a certain volume (y1) for a certain amount of time (x1)
stop the sound for a certain amount of time (x2)
play anouther sound at another volume (y2) for a certain amount of time (x3)
the program works but what I want to add now is a way for me to change these variables in the serial monitor.
I'm thinking it would be something like this:
open the serial monitor.
type "change"
print "set y1"
wait for a value to be typed in
store the input as y1
print "set y2"
wait for a value to be typed in
store the input as y2
print "set x1"
wait for a value to be typed in
store the input as x1.
print "set x2"
wait for a value to be typed in
store the input as x2.
print "set x3"
wait for a value to be typed in
store the input as x3.
and once the variables have been changed, when the button is pressed again the time and volume should follow the new variables.
Also your delay( ) may get in the way. BUT if the inputs are short (<64bytes) the SoftwareSerial RX buffer can hold the next input until you get around to reading it.