Dan Laüt
This interfaces a Max toggle with an Arduino or Teensy. Take it from there.
(Requires Max 6 & higher for the string object.)