I am working on something where I use Spark.function() to pass a string to a function, the string can look like this 1-10-500 or 1-3-1000 or even 1-4-43209 or something completely different…
In the string I set pin-[state/pulses]-delay
Pin can go from 0 to 7.
State can be 0 or 1 when no delay is set, or from 1 to pretty much everything when a delay is set.
Delay can go from 1 to also almost everything.
When no delay is set, a string like “1-1” would set pin 1 high, and “2-0” would set pin 2 low.
If the delay is added like “1-10-500” pin 1 will make a pulse 10 times, with 500ms delay.
My problem now is that I have problems getting the pin number, the state number and the delay number out of the string and into an integer. Are there anyone who can help me with that?