Closed AchimPieters closed 5 years ago
How's your wiring look like?
Also, why do you put "Lock Mechanism Accessory" in the title while the actual problem is with button?
Here's one of my wiring examples, I have tried several setup's but unfortunately without succes.
I just changed the GPIO's:
// The GPIO pin that is connected to a relay
const int relay_gpio = 12;
// The GPIO pin that is connected to a LED
// const int led_gpio = 13;
const int led_gpio = 2;
// The GPIO pin that is connected to a button
// const int button_gpio = 0;
const int button_gpio = 14;
Title: changed! :thumbsup:
Ok, I'm not sure about whether you need an external pullup resistor for reset and program buttons (haven't tried it on bare esp-12 module), but for your other button you do not need pullup resistor, esp-button library (I assume you use that one) will do that for you. BTW this is active low configuration. Although this should not cause issues you're experiencing. What's your code look like?
Here's My Code:
#include <stdio.h>
//#include <espressif/esp_wifi.h>
//#include <espressif/esp_sta.h>>
#include <espressif/esp_common.h>
#include <esp/uart.h>
#include <esp8266.h>
#include <FreeRTOS.h>
#include <task.h>
#include <etstimer.h>
#include <esplibs/libmain.h>
#include <homekit/homekit.h>
#include <homekit/characteristics.h>
//#include "wifi.h"
#include <wifi_config.h>
#include "button.h"
// The GPIO pin that is connected to a relay
const int relay_gpio = 12;
// The GPIO pin that is connected to a LED
// const int led_gpio = 13;
const int led_gpio = 2;
// The GPIO pin that is connected to a button
// const int button_gpio = 0;
const int button_gpio = 14;
// Timeout in seconds to open lock for
const int unlock_period = 5; // 5 seconds
// Which signal to send to relay to open the lock (0 or 1)
const int relay_open_signal = 1;
void lock_lock();
void lock_unlock();
void relay_write(int value) {
gpio_write(relay_gpio, value ? 1 : 0);
}
void led_write(bool on) {
gpio_write(led_gpio, on ? 0 : 1);
}
void reset_configuration_task() {
//Flash the LED first before we start the reset
for (int i=0; i<3; i++) {
led_write(true);
vTaskDelay(100 / portTICK_PERIOD_MS);
led_write(false);
vTaskDelay(100 / portTICK_PERIOD_MS);
}
printf("Resetting Wifi Config\n");
wifi_config_reset();
vTaskDelay(1000 / portTICK_PERIOD_MS);
printf("Resetting HomeKit Config\n");
homekit_server_reset();
vTaskDelay(1000 / portTICK_PERIOD_MS);
printf("Restarting\n");
sdk_system_restart();
vTaskDelete(NULL);
}
void reset_configuration() {
printf("Resetting configuration\n");
xTaskCreate(reset_configuration_task, "Reset configuration", 256, NULL, 2, NULL);
}
void gpio_init() {
gpio_enable(led_gpio, GPIO_OUTPUT);
led_write(false);
gpio_enable(relay_gpio, GPIO_OUTPUT);
relay_write(!relay_open_signal);
}
void button_callback(uint8_t gpio, button_event_t event) {
switch (event) {
case button_event_single_press:
printf("Toggling relay\n");
lock_unlock();
break;
case button_event_long_press:
reset_configuration();
break;
default:
printf("Unknown button event: %d\n", event);
}
}
void lock_identify_task(void *_args) {
// We identify the Sonoff by Flashing it's LED.
for (int i=0; i<3; i++) {
for (int j=0; j<2; j++) {
led_write(true);
vTaskDelay(100 / portTICK_PERIOD_MS);
led_write(false);
vTaskDelay(100 / portTICK_PERIOD_MS);
}
vTaskDelay(250 / portTICK_PERIOD_MS);
}
led_write(false);
vTaskDelete(NULL);
}
void lock_identify(homekit_value_t _value) {
printf("Lock identify\n");
xTaskCreate(lock_identify_task, "Lock identify", 128, NULL, 2, NULL);
}
typedef enum {
lock_state_unsecured = 0,
lock_state_secured = 1,
lock_state_jammed = 2,
lock_state_unknown = 3,
} lock_state_t;
homekit_characteristic_t name = HOMEKIT_CHARACTERISTIC_(NAME, "Lock");
homekit_characteristic_t lock_current_state = HOMEKIT_CHARACTERISTIC_(
LOCK_CURRENT_STATE,
lock_state_unknown,
);
void lock_target_state_setter(homekit_value_t value);
homekit_characteristic_t lock_target_state = HOMEKIT_CHARACTERISTIC_(
LOCK_TARGET_STATE,
lock_state_secured,
.setter=lock_target_state_setter,
);
void lock_target_state_setter(homekit_value_t value) {
lock_target_state.value = value;
if (value.int_value == 0) {
lock_unlock();
} else {
lock_lock();
}
}
void lock_control_point(homekit_value_t value) {
// Nothing to do here
}
ETSTimer lock_timer;
void lock_lock() {
sdk_os_timer_disarm(&lock_timer);
relay_write(!relay_open_signal);
led_write(false);
if (lock_current_state.value.int_value != lock_state_secured) {
lock_current_state.value = HOMEKIT_UINT8(lock_state_secured);
homekit_characteristic_notify(&lock_current_state, lock_current_state.value);
}
}
void lock_timeout() {
if (lock_target_state.value.int_value != lock_state_secured) {
lock_target_state.value = HOMEKIT_UINT8(lock_state_secured);
homekit_characteristic_notify(&lock_target_state, lock_target_state.value);
}
lock_lock();
}
void lock_init() {
lock_current_state.value = HOMEKIT_UINT8(lock_state_secured);
homekit_characteristic_notify(&lock_current_state, lock_current_state.value);
sdk_os_timer_disarm(&lock_timer);
sdk_os_timer_setfn(&lock_timer, lock_timeout, NULL);
}
void lock_unlock() {
relay_write(relay_open_signal);
led_write(true);
lock_current_state.value = HOMEKIT_UINT8(lock_state_unsecured);
homekit_characteristic_notify(&lock_current_state, lock_current_state.value);
if (unlock_period) {
sdk_os_timer_disarm(&lock_timer);
sdk_os_timer_arm(&lock_timer, unlock_period * 1000, 0);
}
}
homekit_accessory_t *accessories[] = {
HOMEKIT_ACCESSORY(.id=1, .category=homekit_accessory_category_door_lock, .services=(homekit_service_t*[]){
HOMEKIT_SERVICE(ACCESSORY_INFORMATION, .characteristics=(homekit_characteristic_t*[]){
&name,
HOMEKIT_CHARACTERISTIC(MANUFACTURER, "StudioPieters®"),
HOMEKIT_CHARACTERISTIC(SERIAL_NUMBER, "201905261408"),
HOMEKIT_CHARACTERISTIC(MODEL, "Basic Lock"),
HOMEKIT_CHARACTERISTIC(FIRMWARE_REVISION, "0.1"),
HOMEKIT_CHARACTERISTIC(IDENTIFY, lock_identify),
NULL
}),
HOMEKIT_SERVICE(LOCK_MECHANISM, .primary=true, .characteristics=(homekit_characteristic_t*[]){
HOMEKIT_CHARACTERISTIC(NAME, "Lock"),
&lock_current_state,
&lock_target_state,
NULL
}),
HOMEKIT_SERVICE(LOCK_MANAGEMENT, .characteristics=(homekit_characteristic_t*[]){
HOMEKIT_CHARACTERISTIC(LOCK_CONTROL_POINT,
.setter=lock_control_point
),
HOMEKIT_CHARACTERISTIC(VERSION, "1"),
NULL
}),
NULL
}),
NULL
};
homekit_server_config_t config = {
.accessories = accessories,
.password = "345-58-410",
.setupId="0LK7",
};
void on_wifi_ready() {
homekit_server_init(&config);
}
void create_accessory_name() {
uint8_t macaddr[6];
sdk_wifi_get_macaddr(STATION_IF, macaddr);
int name_len = snprintf(NULL, 0, "Lock-%02X%02X%02X",
macaddr[3], macaddr[4], macaddr[5]);
char *name_value = malloc(name_len+1);
snprintf(name_value, name_len+1, "Lock-%02X%02X%02X",
macaddr[3], macaddr[4], macaddr[5]);
name.value = HOMEKIT_STRING(name_value);
}
void user_init(void) {
uart_set_baud(0, 115200);
create_accessory_name();
wifi_config_init("lock", NULL, on_wifi_ready);
gpio_init();
lock_init();
if (button_create(button_gpio, 0, 4000, button_callback)) {
printf("Failed to initialize button\n");
}
}
You're still using old button library which only supports "active high" configuration.
Yes that's right. But What I have done is changed the GPIO to the original numbers (eg 2,4 and 12). Then I also changed the hardware so I matches the code. And voila it works... or not...
When I press the button a few times the ESP crashes and doest cam back See error below. When You open the lock trough Homekit and the press the button it crashed also see error below.
>>> HomeKit: [Client 5] Update Characteristics
>>> HomeKit: [Client 5] Get Characteristics
>>> HomeKit: [Client 5] Update Characteristics
>>> HomeKit: [Client 5] Update Characteristics
Toggling relay
>>> HomeKit: [Client 7] Update Characteristics
>>> HomeKit: [Client 7] Get Characteristics
>>> HomeKit: [Client 7] Update Characteristics
Resetting configuration
Resetting Wifi Config
Resetting HomeKit Config
Restarting
rm match
del if0
usl
sul 0 0
!!! HomeKit: [Client 7] Error reading data from socket (code 113). Disconnecting
!!! HomeKit: [Client 6] Error reading data from socket (code 113). Disconnecting
!!! HomeKit: [Client 4] Error reading data from socket (code 113). Disconnecting
!!! HomeKit: [Client 5] Error reading data from socket (code 113). Disconnecting
>>> HomeKit: [Client 7] Closing client connection
>>> HomeKit: [Client 6] Closing client connection
>>> HomeKit: [Client 4] Closing client connection
>>> HomeKit: [Client 5] Closing client connection
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x40100000, len 2292, room 16
tail 4
chksum 0x57
load 0x3ffe8000, len 772, room 4
tail 0
chksum 0x0b
csum 0x0b
rBoot v1.4.0 - richardaburton@gmail.com
Flash Size: 8 Mbit
Flash Mode: DOUT
Flash Speed: 40 MHz
rBoot Option: Big flash
rBoot Option: RTC data
Booting rom 0.
pp_task_hdl : 3fff00a0, prio:14, stack:512
pm_task_hdl : 3ffef990, prio:1, stack:176
frc2_timer_task_hdl:0x3fff4028, prio:12, stack:200
ESP-Open-SDK ver: 0.0.1 compiled @ May 29 2019 16:59:53
phy ver: 273, pp ver: 8.3
>>> wifi_config: Initializing WiFi config
>>> wifi_config: wifi_config_station_connect: No configuration found
>>> wifi_config: Starting AP mode
>>> wifi_config: wifi_config_softap_start: Starting AP SSID=lock-B8D61D
>>> wifi_config: Starting DHCP server
mode : sta(5c:cf:7f:b8:d6:1d) + softAP(5e:cf:7f:b8:d6:1d)
add if0
add if1
bcn 100
>>> wifi_config: Starting WiFi scan
scandone
>>> wifi_config: Starting DNS server
>>> wifi_config: Staring HTTP server
scandone
reconnect
scandone
add 0
aid 2
cnt
connected with AirPort Network, channel 6
dhcp client start...
ip:192.168.178.26,mask:255.255.255.0,gw:192.168.178.1
scandone
and then it stops when I give a reset:
ESP-Open-SDK ver: 0.0.1 compiled @ May 29 2019 16:59:53
phy ver: 273, pp ver: 8.3
>>> wifi_config: Initializing WiFi config
>>> wifi_config: wifi_config_station_connect: No configuration found
>>> wifi_config: Starting AP mode
>>> wifi_config: wifi_config_softap_start: Starting AP SSID=lock-B8D61D
>>> wifi_config: Starting DHCP server
mode : sta(5c:cf:7f:b8:d6:1d) + softAP(5e:cf:7f:b8:d6:1d)
add if0
add if1
bcn 100
>>> wifi_config: Starting WiFi scan
scandone
>>> wifi_config: Starting DNS server
>>> wifi_config: Staring HTTP server
scandone
reconnect
scandone
add 0
aid 4
cnt
connected with AirPort Network, channel 6
dhcp client start...
ip:192.168.178.26,mask:255.255.255.0,gw:192.168.178.1
scandone
I can only do a clean install?
So I have tested some more. but first my real life setup:
As I said above, the setup crashes. When pushing the button as the lock is activated with homekit.
Then I took a look at the other examples there ore more based upon this setting for example sonoff_basic
The only thing I have to do is change te GPIO's
// The GPIO pin that is connected to the relay on the Sonoff Basic.
const int relay_gpio = 12;
// The GPIO pin that is connected to the LED on the Sonoff Basic.
const int led_gpio = 2;
// The GPIO pin that is oconnected to the button on the Sonoff Basic.
const int button_gpio = 4;
and I can use my existing setup above. But also here it crashes? How can I solve this?
I know for a fact that this hardware setup works perfect, I have tested it more than once with other examples from your repository, and they all work fine and stable. Only when a button is used, then Something goes wrong, it really a pain in the A#@@ :unamused:
Next Test:
I changed the button library to the new one. Here's the code:
#include <stdio.h>
#include <stdlib.h>
//#include <espressif/esp_wifi.h>
//#include <espressif/esp_sta.h>>
#include <espressif/esp_common.h>
#include <esp/uart.h>
#include <esp8266.h>
#include <FreeRTOS.h>
#include <task.h>
#include <etstimer.h>
#include <esplibs/libmain.h>
#include <homekit/homekit.h>
#include <homekit/characteristics.h>
//#include "wifi.h"
#include <wifi_config.h>
#include "button.h"
const int BUTTON_GPIO = 4;
// The GPIO pin that is connected to a relay
const int relay_gpio = 12;
// The GPIO pin that is connected to a LED
// const int led_gpio = 13;
const int led_gpio = 2;
// Timeout in seconds to open lock for
const int unlock_period = 5; // 5 seconds
// Which signal to send to relay to open the lock (0 or 1)
const int relay_open_signal = 1;
void lock_lock();
void lock_unlock();
void relay_write(int value) {
gpio_write(relay_gpio, value ? 1 : 0);
}
void led_write(bool on) {
gpio_write(led_gpio, on ? 0 : 1);
}
void reset_configuration_task() {
//Flash the LED first before we start the reset
for (int i=0; i<3; i++) {
led_write(true);
vTaskDelay(100 / portTICK_PERIOD_MS);
led_write(false);
vTaskDelay(100 / portTICK_PERIOD_MS);
}
printf("Resetting Wifi Config\n");
wifi_config_reset();
vTaskDelay(1000 / portTICK_PERIOD_MS);
printf("Resetting HomeKit Config\n");
homekit_server_reset();
vTaskDelay(1000 / portTICK_PERIOD_MS);
printf("Restarting\n");
sdk_system_restart();
vTaskDelete(NULL);
}
void reset_configuration() {
printf("Resetting configuration\n");
xTaskCreate(reset_configuration_task, "Reset configuration", 256, NULL, 2, NULL);
}
void gpio_init() {
gpio_enable(led_gpio, GPIO_OUTPUT);
led_write(false);
gpio_enable(relay_gpio, GPIO_OUTPUT);
relay_write(!relay_open_signal);
}
void idle_task(void* arg) {
while (true) {
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
vTaskDelete(NULL);
}
void button_callback(button_event_t event, void* context) {
switch (event) {
case button_event_single_press:
printf("Toggling relay\n");
lock_unlock();
break;
case button_event_long_press:
reset_configuration();
break;
default:
printf("Unknown button event: %d\n", event);
}
}
void lock_identify_task(void *_args) {
// We identify the Sonoff by Flashing it's LED.
for (int i=0; i<3; i++) {
for (int j=0; j<2; j++) {
led_write(true);
vTaskDelay(100 / portTICK_PERIOD_MS);
led_write(false);
vTaskDelay(100 / portTICK_PERIOD_MS);
}
vTaskDelay(250 / portTICK_PERIOD_MS);
}
led_write(false);
vTaskDelete(NULL);
}
void lock_identify(homekit_value_t _value) {
printf("Lock identify\n");
xTaskCreate(lock_identify_task, "Lock identify", 128, NULL, 2, NULL);
}
typedef enum {
lock_state_unsecured = 0,
lock_state_secured = 1,
lock_state_jammed = 2,
lock_state_unknown = 3,
} lock_state_t;
homekit_characteristic_t name = HOMEKIT_CHARACTERISTIC_(NAME, "Lock");
homekit_characteristic_t lock_current_state = HOMEKIT_CHARACTERISTIC_(
LOCK_CURRENT_STATE,
lock_state_unknown,
);
void lock_target_state_setter(homekit_value_t value);
homekit_characteristic_t lock_target_state = HOMEKIT_CHARACTERISTIC_(
LOCK_TARGET_STATE,
lock_state_secured,
.setter=lock_target_state_setter,
);
void lock_target_state_setter(homekit_value_t value) {
lock_target_state.value = value;
if (value.int_value == 0) {
lock_unlock();
} else {
lock_lock();
}
}
void lock_control_point(homekit_value_t value) {
// Nothing to do here
}
ETSTimer lock_timer;
void lock_lock() {
sdk_os_timer_disarm(&lock_timer);
relay_write(!relay_open_signal);
led_write(false);
if (lock_current_state.value.int_value != lock_state_secured) {
lock_current_state.value = HOMEKIT_UINT8(lock_state_secured);
homekit_characteristic_notify(&lock_current_state, lock_current_state.value);
}
}
void lock_timeout() {
if (lock_target_state.value.int_value != lock_state_secured) {
lock_target_state.value = HOMEKIT_UINT8(lock_state_secured);
homekit_characteristic_notify(&lock_target_state, lock_target_state.value);
}
lock_lock();
}
void lock_init() {
lock_current_state.value = HOMEKIT_UINT8(lock_state_secured);
homekit_characteristic_notify(&lock_current_state, lock_current_state.value);
sdk_os_timer_disarm(&lock_timer);
sdk_os_timer_setfn(&lock_timer, lock_timeout, NULL);
}
void lock_unlock() {
relay_write(relay_open_signal);
led_write(true);
lock_current_state.value = HOMEKIT_UINT8(lock_state_unsecured);
homekit_characteristic_notify(&lock_current_state, lock_current_state.value);
if (unlock_period) {
sdk_os_timer_disarm(&lock_timer);
sdk_os_timer_arm(&lock_timer, unlock_period * 1000, 0);
}
}
homekit_accessory_t *accessories[] = {
HOMEKIT_ACCESSORY(.id=1, .category=homekit_accessory_category_door_lock, .services=(homekit_service_t*[]){
HOMEKIT_SERVICE(ACCESSORY_INFORMATION, .characteristics=(homekit_characteristic_t*[]){
&name,
HOMEKIT_CHARACTERISTIC(MANUFACTURER, "StudioPieters®"),
HOMEKIT_CHARACTERISTIC(SERIAL_NUMBER, "201905261408"),
HOMEKIT_CHARACTERISTIC(MODEL, "Basic Lock"),
HOMEKIT_CHARACTERISTIC(FIRMWARE_REVISION, "0.1"),
HOMEKIT_CHARACTERISTIC(IDENTIFY, lock_identify),
NULL
}),
HOMEKIT_SERVICE(LOCK_MECHANISM, .primary=true, .characteristics=(homekit_characteristic_t*[]){
HOMEKIT_CHARACTERISTIC(NAME, "Lock"),
&lock_current_state,
&lock_target_state,
NULL
}),
HOMEKIT_SERVICE(LOCK_MANAGEMENT, .characteristics=(homekit_characteristic_t*[]){
HOMEKIT_CHARACTERISTIC(LOCK_CONTROL_POINT,
.setter=lock_control_point
),
HOMEKIT_CHARACTERISTIC(VERSION, "1"),
NULL
}),
NULL
}),
NULL
};
homekit_server_config_t config = {
.accessories = accessories,
.password = "345-58-410",
.setupId="0LK7",
};
void on_wifi_ready() {
homekit_server_init(&config);
}
void create_accessory_name() {
uint8_t macaddr[6];
sdk_wifi_get_macaddr(STATION_IF, macaddr);
int name_len = snprintf(NULL, 0, "Lock-%02X%02X%02X",
macaddr[3], macaddr[4], macaddr[5]);
char *name_value = malloc(name_len+1);
snprintf(name_value, name_len+1, "Lock-%02X%02X%02X",
macaddr[3], macaddr[4], macaddr[5]);
name.value = HOMEKIT_STRING(name_value);
}
void user_init(void) {
uart_set_baud(0, 115200);
create_accessory_name();
wifi_config_init("lock", NULL, on_wifi_ready);
gpio_init();
lock_init();
button_config_t button_config = BUTTON_CONFIG(
.active_level=button_active_low,
);
int r = button_create(BUTTON_GPIO, button_config, button_callback, NULL);
if (r) {
printf("Failed to initalize button (code %d)\n", r);
}
printf("Button example\n");
xTaskCreate(idle_task, "Idle task", 256, NULL, tskIDLE_PRIORITY, NULL);
}
Changed the Hardware to the correct setup with active low - signal connects to ground when button is pressed, as also defined in the code.
Everything works, after adding to HomeKit, I can toggle the "lock". But when I press the button once the lock turns on and after 5 second is turns nicely off. when I press the button one the lock turns on butt when I hold the button it turns off and I get this error:
>>> HomeKit: [Client 5] Get Characteristics
>>> HomeKit: [Client 5] Update Characteristics
>>> HomeKit: [Client 5] Update Characteristics
>>> HomeKit: [Client 5] Update Characteristics
Toggling relay
Toggling relay
Resetting configuration
Resetting Wifi Config
Resetting HomeKit Config
Restarting
rm match
del if0
usl
sul 0 0
!!! HomeKit: [Client 7] Error reading data from socket (code 113). Disconnecting
!!! HomeKit: [Client 6] Error reading data from socket (code 113). Disconnecting
!!! HomeKit: [Client 4] Error reading data from socket (code 113). Disconnecting
!!! HomeKit: [Client 5] Error reading data from socket (code 113). Disconnecting
>>> HomeKit: [Client 7] Closing client connection
>>> HomeKit: [Client 6] Closing client connection
>>> HomeKit: [Client 4] Closing client connection
>>> HomeKit: [Client 5] Closing client connection
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x40100000, len 2292, room 16
tail 4
chksum 0x57
load 0x3ffe8000, len 772, room 4
tail 0
chksum 0x0b
csum 0x0b
rBoot v1.4.0 - richardaburton@gmail.com
Flash Size: 8 Mbit
Flash Mode: DOUT
Flash Speed: 40 MHz
rBoot Option: Big flash
rBoot Option: RTC data
Booting rom 0.
pp_task_hdl : 3fff00a0, prio:14, stack:512
pm_task_hdl : 3ffef990, prio:1, stack:176
frc2_timer_task_hdl:0x3fff4028, prio:12, stack:200
ESP-Open-SDK ver: 0.0.1 compiled @ May 31 2019 11:32:59
phy ver: 273, pp ver: 8.3
>>> wifi_config: Initializing WiFi config
>>> wifi_config: wifi_config_station_connect: No configuration found
>>> wifi_config: Starting AP mode
>>> wifi_config: wifi_config_softap_start: Starting AP SSID=lock-B8D61D
>>> wifi_config: Starting DHCP server
Button example
mode : sta(5c:cf:7f:b8:d6:1d) + softAP(5e:cf:7f:b8:d6:1d)
add if0
add if1
bcn 100
>>> wifi_config: Starting WiFi scan
scandone
>>> wifi_config: Starting DNS server
>>> wifi_config: Staring HTTP server
scandone
reconnect
scandone
add 0
aid 4
cnt
connected with AirPort Network, channel 6
dhcp client start...
ip:192.168.178.26,mask:255.255.255.0,gw:192.168.178.1
scandone
scandone
scandone
scandone
scandone
scandone
scandone
scandone
scandone
scandone
no buf for probe, ie len 0
scandone
scandone
scandone
scandone
no buf for probe, ie len 0
scandone
scandone
scandone
scandone
scandone
scandone
scandone
scandone
no buf for probe, ie len 0
no buf for probe, ie len 0
scandone
scandone
scandone
So now I don't know any other solution? Do you?
Update:
Okay solved it by changing this line:
case button_event_long_press:
reset_configuration();
break;
to
case button_event_long_press:
lock_lock();
break;
Now it works! but I still have a question: what does the reset_configuration();
should do? beside reset configuration? Because it does't seems to work?
Hi maxim,
While making you lock mechanism accessory I stumble upon one problem: The Button Part. Everting works The lock, the LED. unfortunately the button doesn't. You used a different approach for the button part as in your default Button.c files.
I have tried:
active high - signal goes from low to high when button is pressed. active low - signal connects to ground when button is pressed.
But noting happens, It even doesn't show in the terminal? Do you have a Idea?