Scenario
You want to use a programmable MIDI foot controller, or your sequencer, to control SW1 and SW2 on your M3.
Procedure
In many cases SW1 and SW2 are assigned to CC#80 and CC#81 - then you can just send MIDI CC messages to change SW1&2 state. If SW1 or SW2 are assigned to some other function (Octave UP/Down, joystick or ribbon lock etc), you need to use SysEx (System Exclusive). You would program the device or your sequencer to send the following messages:
Combi SW1:
F0 42 30 75 41 00 00 01 00 0A 00 00 00 00 01 F7 - on
F0 42 30 75 41 00 00 01 00 0A 00 00 00 00 00 F7 - off
Combi SW2:
F0 42 30 75 41 00 00 01 00 0B 00 00 00 00 01 F7 - on
F0 42 30 75 41 00 00 01 00 0B 00 00 00 00 00 F7 - off
Prog SW1:
F0 42 30 75 41 02 00 01 00 09 00 00 00 00 01 F7 - on
F0 42 30 75 41 02 00 01 00 09 00 00 00 00 00 F7 - off
Prog SW2:
F0 42 30 75 41 02 00 00 00 0A 00 00 00 00 01 F7 - on
F0 42 30 75 41 02 00 00 00 0A 00 00 00 00 00 F7 - off
Seq SW1:
F0 42 30 75 41 04 00 00 00 07 00 00 00 00 01 F7 - on
F0 42 30 75 41 04 00 00 00 07 00 00 00 00 00 F7 - off
Seq SW2:
F0 42 30 75 41 04 00 00 00 08 00 00 00 00 01 F7 - on
F0 42 30 75 41 04 00 00 00 08 00 00 00 00 00 F7 - off
Note that the message is different for each mode.
Tips
Note that you can find out these kinds of things by using a MIDI monitoring application on your PC or Mac and watching what happens when you press buttons or move things. For more information on SysEx and how to find out various messages for your keyboard, see this article: