Skip to content

Instantly share code, notes, and snippets.

@glmnet
Last active November 25, 2025 08:31
Show Gist options
  • Select an option

  • Save glmnet/49ca3d6a9742fc3649f4fbdeaa4cdf5d to your computer and use it in GitHub Desktop.

Select an option

Save glmnet/49ca3d6a9742fc3649f4fbdeaa4cdf5d to your computer and use it in GitHub Desktop.
// this gist is no longer needed,
// see https://github.com/glmnet/esphome-components/blob/main/docs/arduino_port_extender.md
// for up to date information
// this gist is no longer needed,
// see https://github.com/glmnet/esphome-components/blob/main/docs/arduino_port_extender.md
// for up to date information
@vitucciog
Copy link

vitucciog commented Mar 29, 2025

Hi @glmnet,
any chance you make a version for Arduino Mega 2560?
I've been using a modified version from @thebradleysanders in the last years, but with the migration from custom to external components I've lost the possibility to update my devices with the latest versions of esphome.

Thanks. Bye,
Vito

@sonulgupta
Copy link

sonulgupta commented Nov 24, 2025

Hi @thebradleysanders Arduino Mega 2560 is not working properly in latest esphome. During compile getting continuous error with arduino_port_expander.h file. Please look into it for resolution.

Error as per below-:
In file included from src/main.cpp:610:
/config/esphome/waveshare-esp32-s3.yaml: In lambda function:
/config/esphome/waveshare-esp32-s3.yaml:291:33: error: 'expander1' is not captured
291 | return {ape_binary_output(expander1, 48),
| ^~~~~~~~~
src/arduino_port_expander.h:41:65: note: in definition of macro 'get_ape'
41 | #define get_ape(constructor) static_cast<ArduinoPortExpander *>(constructor.get_component(0))
| ^~~~~~~~~~~
/config/esphome/waveshare-esp32-s3.yaml:291:15: note: in expansion of macro 'ape_binary_output'
291 | return {ape_binary_output(expander1, 48),
| ^~~~~~~~~~~~~~~~~
/config/esphome/waveshare-esp32-s3.yaml:891:122: note: the lambda has no capture-default
891 | name: "On_Brighten11"
| ^
src/main.cpp:879:48: note: 'esphome::custom_component::CustomComponentConstructor expander1' declared here
879 | custom_component::CustomComponentConstructor expander1 = custom_component::CustomComponentConstructor( -> std::vector<Component *> {
| ^~~~~~~~~
/config/esphome/waveshare-esp32-s3.yaml:292:33: error: 'expander1' is not captured
292 | ape_binary_output(expander1, 49),
| ^~~~~~~~~
src/arduino_port_expander.h:41:65: note: in definition of macro 'get_ape'
41 | #define get_ape(constructor) static_cast<ArduinoPortExpander *>(constructor.get_component(0))
| ^~~~~~~~~~~
/config/esphome/waveshare-esp32-s3.yaml:292:15: note: in expansion of macro 'ape_binary_output'
292 | ape_binary_output(expander1, 49),
| ^~~~~~~~~~~~~~~~~
/config/esphome/waveshare-esp32-s3.yaml:891:122: note: the lambda has no capture-default
891 | name: "On_Brighten11"
| ^
src/main.cpp:879:48: note: 'esphome::custom_component::CustomComponentConstructor expander1' declared here
879 | custom_component::CustomComponentConstructor expander1 = custom_component::CustomComponentConstructor( -> std::vector<Component *> {
| ^~~~~~~~~
/config/esphome/waveshare-esp32-s3.yaml:293:33: error: 'expander1' is not captured
293 | ape_binary_output(expander1, 50),
| ^~~~~~~~~
src/arduino_port_expander.h:41:65: note: in definition of macro 'get_ape'
41 | #define get_ape(constructor) static_cast<ArduinoPortExpander *>(constructor.get_component(0))
| ^~~~~~~~~~~
/config/esphome/waveshare-esp32-s3.yaml:293:15: note: in expansion of macro 'ape_binary_output'
293 | ape_binary_output(expander1, 50),
| ^~~~~~~~~~~~~~~~~
/config/esphome/waveshare-esp32-s3.yaml:891:122: note: the lambda has no capture-default
891 | name: "On_Brighten11"
| ^
src/main.cpp:879:48: note: 'esphome::custom_component::CustomComponentConstructor expander1' declared here
879 | custom_component::CustomComponentConstructor expander1 = custom_component::CustomComponentConstructor( -> std::vector<Component *> {
| ^~~~~~~~~
/config/esphome/waveshare-esp32-s3.yaml:294:33: error: 'expander1' is not captured
294 | ape_binary_output(expander1, 51),
| ^~~~~~~~~
src/arduino_port_expander.h:41:65: note: in definition of macro 'get_ape'
41 | #define get_ape(constructor) static_cast<ArduinoPortExpander *>(constructor.get_component(0))
| ^~~~~~~~~~~
/config/esphome/waveshare-esp32-s3.yaml:294:15: note: in expansion of macro 'ape_binary_output'
294 | ape_binary_output(expander1, 51),
| ^~~~~~~~~~~~~~~~~
/config/esphome/waveshare-esp32-s3.yaml:891:122: note: the lambda has no capture-default
891 | name: "On_Brighten11"
| ^
src/main.cpp:879:48: note: 'esphome::custom_component::CustomComponentConstructor expander1' declared here
879 | custom_component::CustomComponentConstructor expander1 = custom_component::CustomComponentConstructor( -> std::vector<Component *> {
| ^~~~~~~~~
/config/esphome/waveshare-esp32-s3.yaml:295:33: error: 'expander1' is not captured
295 | ape_binary_output(expander1, 52),
| ^~~~~~~~~
src/arduino_port_expander.h:41:65: note: in definition of macro 'get_ape'
41 | #define get_ape(constructor) static_cast<ArduinoPortExpander *>(constructor.get_component(0))
| ^~~~~~~~~~~
/config/esphome/waveshare-esp32-s3.yaml:295:15: note: in expansion of macro 'ape_binary_output'
295 | ape_binary_output(expander1, 52),
| ^~~~~~~~~~~~~~~~~
/config/esphome/waveshare-esp32-s3.yaml:891:122: note: the lambda has no capture-default
891 | name: "On_Brighten11"
| ^
src/main.cpp:879:48: note: 'esphome::custom_component::CustomComponentConstructor expander1' declared here
879 | custom_component::CustomComponentConstructor expander1 = custom_component::CustomComponentConstructor( -> std::vector<Component *> {
| ^~~~~~~~~
/config/esphome/waveshare-esp32-s3.yaml:296:33: error: 'expander1' is not captured
296 | ape_binary_output(expander1, 13)};
| ^~~~~~~~~
src/arduino_port_expander.h:41:65: note: in definition of macro 'get_ape'
41 | #define get_ape(constructor) static_cast<ArduinoPortExpander *>(constructor.get_component(0))
| ^~~~~~~~~~~
/config/esphome/waveshare-esp32-s3.yaml:296:15: note: in expansion of macro 'ape_binary_output'
296 | ape_binary_output(expander1, 13)};
| ^~~~~~~~~~~~~~~~~
/config/esphome/waveshare-esp32-s3.yaml:891:122: note: the lambda has no capture-default
891 | name: "On_Brighten11"
| ^
src/main.cpp:879:48: note: 'esphome::custom_component::CustomComponentConstructor expander1' declared here
879 | custom_component::CustomComponentConstructor expander1 = custom_component::CustomComponentConstructor( -> std::vector<Component *> {
| ^~~~~~~~~
/config/esphome/waveshare-esp32-s3.yaml:296:47: error: could not convert '{, , , , , }' from '' to 'std::vectoresphome::output::BinaryOutput*'
296 | ape_binary_output(expander1, 13)};
| ^
| |
|

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment