-
Notifications
You must be signed in to change notification settings - Fork 11
The "event source" will provide information about any user activities to M2tklib. M2tklib must have an event source, otherwise nothing will happen on the dialog form.
The "event source" is a callback procedure. Some predefined callback procedures already exist (like m2_es_arduino
. This tutorial will provide information how to create a custom event source:
- Template and Structure of the event source
- Serveral examples
A custom event source is required if the input hardware is not supported by the standard event source (input buttons with one ADC port, numeric key pad)
- Note:
M2_KEY_SELECT2
must not be used. Instead useM2_KEY_SELECT
twice.
All following examples will ignore m2.setPin
/m2_SetPin
. Hardware pins are assumed to be fixed and are "hard coded" in the example software.
Predefined event handlers assume negative logic for the input buttons. Often a controller has build-in pull-up resistors. This internal resitor can be used to build a simple input button. However, in this case logical 0 means "button is pressed" and logical 1 means "button is not pressed".
On the other hand, many Arduino examples use positive logic for the input buttons (see here: http://arduino.cc/en/tutorial/button). An additional external resistor is required and the logic is inverted: 0 means "button is not pressed" and logical 1 means "button is pressed".
- Previous Tutorial: t10
- Wiki Start Page