statement Feature_command_buttons

Arduino MEGA 2560

What happens to this pin-setting?

#ifdef FEATURE_COMMAND_BUTTONS
#define analog_buttons_pin A0
#define command_mode_active_led 26
#endif //FEATURE_COMMAND_BUTTONS

#define FEATURE_COMMAND_BUTTONS

You'll have to be more specific in your question. The function of that code seems quite obvious:

  • If FEATURE_COMMAND_BUTTONS has been defined then define analog_buttons_pin as A1 and define command_mode_active_led as 26.
  • Define the FEATURE_COMMAND_BUTTONS macro.

You're quite right, OK there we go,

The ledge is supposed to burn if you press S1 once.
The ledge goes out if you're pressed again.
I follow a manual of KF4BZT, Arduino CW Keyer Project (Alpha) | kf4bzt,
in which he describes step-by-step the construction of a CW Keyer of K2NG, (radio amateurs).

However, the K2NG sketch is intended for the Arduino UNO and KF4BZT modified the sketch for myArduino MEGA.

The scheme I've shown has been modified because the on-site schedule contains essential errors.
The relevant components are on my breadboard.
Unfortunately, this sketch does not work. tried a lot, but I can not find the error, maybe you?

I've added the two relevant .h files, note that this is only the Command section of the sketch, so the first step, the rest is not yet applicable.

keyer_features_and_options.h (8.31 KB)

keyer_pin_settings.h (4.26 KB)

PA3CVI:
Unfortunately, this sketch does not work.

Please explain exactly what you mean by does not work.

Note that in keyer_features_and_options.h, line 5, the FEATURE_COMMAND_BUTTONS definition is commented out. The way that file works is you can configure the program by uncommenting or commenting the various lines.

Thanks for your comment.
After compilation and uploading, no problem, the program does not work in other words, the LED on my breadboard does not respond when pressing S1

The keyer_features_and_options.h file is behind the keyer__pin_settings.h file in the Arduino IDE editor.

Below a small piece of the keyer_features_and_options.

void setup() {
/* Pins - you must review these and configure ! */
#ifndef keyer_pin_settings_h
#define keyer_pin_settings_h

#define paddle_left 2
#define paddle_right 5
#define tx_key_line_1 11 // (high = key down/tx on)
#define tx_key_line_2 12
#define tx_key_line_3 0
#define tx_key_line_4 0
#define tx_key_line_5 0
#define tx_key_line_6 0
#define sidetone_line 4 // connect a speaker for sidetone
#define potentiometer A0 // Speed potentiometer (0 to 5 V) Use pot from 1k to 10k
#define ptt_tx_1 0 // PTT ("push to talk") lines
#define ptt_tx_2 0 // Can be used for keying fox transmitter, T/R switch, or keying slow boatanchors
#define ptt_tx_3 0 // These are optional - set to 0 if unused
#define ptt_tx_4 0
#define ptt_tx_5 0
#define ptt_tx_6 0
#define tx_key_dit 0 // if defined, goes active for dit (any transmitter) - customized with tx_key_dit_and_dah_pins_active_state and tx_key_dit_and_dah_pins_inactive_state
#define tx_key_dah 0 // if defined, goes active for dah (any transmitter) - customized with tx_key_dit_and_dah_pins_active_state and tx_key_dit_and_dah_pins_inactive_state

#ifdef FEATURE_COMMAND_BUTTONS
#define analog_buttons_pin A1
#define command_mode_active_led 0
#endif //FEATURE_COMMAND_BUTTONS

/*
FEATURE_SIDETONE_SWITCH
Enabling this feature and an external toggle switch adds switch control for playing cw sidetone.
ST Switch status is displayed in the status command. This feature will override the software control of the sidetone (\o).
Arduino pin is assigned by SIDETONE_SWITCH
*/

#ifdef FEATURE_SIDETONE_SWITCH
#define SIDETONE_SWITCH 8
#endif //FEATURE_SIDETONE_SWITCH

//lcd pins
#ifdef FEATURE_LCD_4BIT
#define lcd_rs A2
#define lcd_enable 10
#define lcd_d4 6
#define lcd_d5 7
#define lcd_d6 8
#define lcd_d7 9
#endif //FEATURE_LCD_4BIT

#ifdef FEATURE_LCD1602_N07DH
#define lcd_rs 8
#define lcd_enable 9
#define lcd_d4 4
#define lcd_d5 5
#define lcd_d6 6
#define lcd_d7 7
#endif //FEATURE_LCD1602_N07DH

//ps2 keyboard pins
#ifdef FEATURE_PS2_KEYBOARD
#define ps2_keyboard_data A3
#define ps2_keyboard_clock 3 // this must be on an interrupt capable pin!
#endif //FEATURE_PS2_KEYBOARD

// rotary encoder pins and options - rotary encoder code from Jim Balls M0CKE
#ifdef FEATURE_ROTARY_ENCODER
#define OPTION_ENCODER_HALF_STEP_MODE // Half-step mode?
#define rotary_pin1 0 // CW Encoder Pin
#define rotary_pin2 0 // CCW Encoder Pin
#define OPTION_ENCODER_ENABLE_PULLUPS // define to enable weak pullups.
#endif //FEATURE_ROTARY_ENCODER

#ifdef FEATURE_LED_RING
#define led_ring_sdi A10 //2 //Data
#define led_ring_clk A9 //3 //Clock
#define led_ring_le A8 //4 //Latch
#endif //FEATURE_LED_RING

#ifdef FEATURE_ALPHABET_SEND_PRACTICE
#define correct_answer_led 0
#define wrong_answer_led 0
#endif //FEATURE_ALPHABET_SEND_PRACTICE

#ifdef FEATURE_PTT_INTERLOCK
#define ptt_interlock 0 // this pin disables PTT and TX KEY
#endif //FEATURE_PTT_INTERLOCK

#ifdef FEATURE_STRAIGHT_KEY
#define pin_straight_key 52
#endif //FEATURE_STRAIGHT_KEY

#ifdef FEATURE_CW_DECODER
#define cw_decoder_pin A3//A11 //A5 //A3
#ifdef OPTION_CW_DECODER_GOERTZEL_AUDIO_DETECTOR
#define cw_decoder_audio_input_pin 0 // this must be an analog pin!
#endif //OPTION_CW_DECODER_GOERTZEL_AUDIO_DETECTOR
#define cw_decoder_indicator 24
#endif //FEATURE_CW_DECODER

#if defined(FEATURE_COMPETITION_COMPRESSION_DETECTION)
#define compression_detection_pin 13
#endif //FEATURE_COMPETITION_COMPRESSION_DETECTION

#if defined(FEATURE_SLEEP)
#define keyer_awake 0
#endif

#if defined(FEATURE_CAPACITIVE_PADDLE_PINS)
#define capactive_paddle_pin_inhibit_pin 0 // if this pin is defined and is set high, the capacitive paddle pins will switch to normal (non-capacitive) sensing mode
#endif

#ifdef FEATURE_4x4_KEYPAD
#define Row3 33
#define Row2 32
#define Row1 31
#define Row0 30
#define Col3 37
#define Col2 36
#define Col1 35
#define Col0 34
#endif

#ifdef FEATURE_3x4_KEYPAD
#define Row3 33
#define Row2 32
#define Row1 31
#define Row0 30
#define Col2 36
#define Col1 35
#define Col0 34
#endif

#else

#error "Multiple pin_settings.h files included somehow..."

#endif //keyer_pin_settings_h

// compile time features and options - comment or uncomment to add or delete features
// FEATURES add more bytes to the compiled binary, OPTIONS change code behavior

#define FEATURE_COMMAND_BUTTONS // Is uncommented 1
// #define FEATURE_COMMAND_LINE_INTERFACE // Command Line Interface functionality
// #define FEATURE_MEMORIES // on the Arduino Due, you must have FEATURE_EEPROM_E24C1024 and E24C1024 EEPROM hardware in order to compile this
// #define FEATURE_MEMORY_MACROS
// #define FEATURE_WINKEY_EMULATION // disabling Automatic Software Reset is highly recommended (see documentation)
// #define FEATURE_BEACON
// #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE
// #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes
// #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h).
// #define FEATURE_SERIAL_HELP
// #define FEATURE_HELL
.
.
.
.and so on.
.
.
.

}

void loop() {
// put your main code here, to run repeatedly:

}

What am I doing wrong,
Note: Only the first step of the project is relevant to me, why does not the LED respond?