MTobjects conventions
Event management for Uno, Nano, Mega

C++ conventions

Functions, variables, types: all in tiny except the first letter of intermediate words
Examples of C ++: delay(), digtalWrite(), int, long...
Exceptions: int8_t...
Examples of MTobjects: onSelect(), onTime(), bounce...
Exceptions: Protected variables start with MT

Constants: capital letters, intermediate words separated by "_"
Examples of C ++: HIGH, INPUT_PULLUP, LED_BUILTIN, NULL...
Exceptions: True, False
Examples of MTobjects: NO_ACTION, MT_INFINI, MT_OK...

Classes and class instances: first letter in capital letter
Examples of C ++: Serial, ...
Exceptions of MTobjects: all starts with MT: MTbutton, MTservo...

Functions, variables, types internal to a library: tiny framed by "_"
Examples of C ++: _delay_ms_...
Examples of mtobjects: _ticksForMTquickObject_, _timeCounterForMTslowObject_...

 

Conventions in addition to MTobjects

Comments for functions: tiny words with at least one "_" inside, but letters at the ends
Examples of MTobjects: micro_seconds, milli_seconds ...

 

MTobjects constants

Global:
NO_ACTION: (= NULL) used to inform that there is no function called to act
MT_ON: (= 1) clock on
MT_OFF: (= 0) clock off
MT_INFINI: (= 0) Number infinite of actions

Buttons:
RADIO_BUTTON_0: (= 0) explicit name for button 0
RADIO_BUTTON_1: (= 1) explicit name for button 1
...
RADIO_BUTTON_8: (= 8) explicit name for button 8
RADIO_BUTTON_9: (= 9) explicit name for button 9
RADIO_GROUPE_0: (= 0) explicit name for group 0
RADIO_GROUPE_1: (= 1) explicit name for group 1
RADIO_GROUPE_2: (= 2) explicit name for group 2
RADIO_GROUPE_3: (= 3) explicit name for group 3

Steppers:
RPM: (= * -1.0) unit for speeds
RPS: (= * -60.0) unit for speeds
CONTINUE: (= maxint) for an infinite rotation
UNCONNECTED: (= -1) indicates an unconnected pin
HALF_STEP: (= 0) to switch to half-step
WHOLE_STEP: (= 1) to stay in step whole
ONE_PHASE: (= -1) one phase at a time (unipolar steppers)
DEFAULT_SENSE: (= false) sense of rotation by default
REVERSE: (= true) for reverse the direction of rotation
NO_ACCELERATION: (= 0) for immediate starts and stops

 

Comments for MTobjects functions

Reminder: word that can be added and having no effect

Global:
micro_seconds: for the times, ex: MTsoftPWM(..., 500 micro_seconds, ...);
micro_second: for the times, ex: MTsoftPWM(..., 1 micro_second, ...);
milli_seconds: for the times, ex: MTclock(500 milli_seconds, ...);
milli_second: for the times, ex: bounce = 1 milli_second;

Buttons:
if_not_pressed: for the state of rest, ex: MTbutton(..., LOW if_not_pressed, ...);

Horloges:
action_and_stop: for the number of action to do, ex: MTclock(..., 1 action_and_stop, ...);
actions_and_stop: for the number of action to do, ex: MTclock(..., 10 actions_and_stop, ...);

PWM:
level_and_stop: for the number of level to do, ex: MTsoftPWM(..., 1 level_and_stop, ...);
levels_and_stop: for the number of action, ex: MTsoftPWM(..., 10 levels_and_stop, ...);
start_with: for the initial level, ex: MTsoftPWM(..., start_with HIGH, ...);
inpulse_width: for the duration of the inpulse, ex: MTsoftPWM(inpulse_width 100 micro_seconds, ...);
inpulses_width: for the duration of the inpulses, ex: MThardPWM(inpulses_width 100 micro_seconds, ...);
period_width: for the duration of the périod, ex: MTsoftPWM(..., period_width 100 micro_seconds, ...);
periods_width: or the duration of the périods, ex: MThardPWM(..., periods_width 100 micro_seconds, ...);
per_cent: for the duty cycles, ex: setDutyCycle(50 per_cent);

Steppers:
pin_Step: indicate which pine it is, ex: MTstepStepper(pin_Step 2, ...);
pin_Dir: indicate which pine it is, ex: MTstepStepper(..., pin_Dir 3, ...);
pin_EN: indicate which pine it is, ex: MTstepStepper(..., pin_EN 4, ...);
pin_A1: indicate which pine it is, ex: MTulnStepper(pin_A1 2, ...);
pin_B1: indicate which pine it is, ex: MTulnStepper(..., pin_B1 3, ...);
pin_A2: indicate which pine it is, ex: MTulnStepper(..., pin_A2 4, ...);
pin_B2: indicate which pine it is, ex: MTulnStepper(..., pin_B2 5, ...);
step_or_micro_step: for the number of steps , ex: MTstepStepper(..., 200 step_or_micro_step, ...);
micro_second_per_step: for the speed, ex: MTstepStepper(..., 1000 micro_second_per_step, ...);
absolute_position: clearly specifies an absolute position, ex: moveTo(absolute_position 1000);
accelerations_of: clearly specifies the acceleration, ex: MTstepStepper(..., accelerations_of 200*16 step_or_micro_step , ...);

Servo:
milli_seconds_for_go_from_0_to_180: specifies time, ex MTservo(..., 1000 milli_seconds_for_go_from_0_to_180, ...);
micro_seconds_initially: pspecifies initial time, ex MTservo(..., 1500 micro_seconds_initially, ...);
degree_initially: specifies the initial position, ex MTservo(..., 90 degree_initially, ...);
micro_seconds_minimum: specifies time for 0°, ex MTservo(..., 500 micro_seconds_minimum, ...);
micro_seconds_maximum: specifies time for 180°, ex MTservo(..., 2500 micro_seconds_maximum, ...);
micro_seconds_per_period: specifies the period, ex MTservo(..., 20000 micro_seconds_per_period, ...);
cad_for_0_degree: specifies the value of analogRead for 0°, ex MTservo(..., 258 cad_for_0_degree, ...);
cad_for_180_degree: specifies the value of analogRead for 180°, ex MTservo(..., 837 cad_for_180_degree, ...);