O'Reilly logo

Internet of Things Programming with JavaScript by Ruben Oliva Ramos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Controlling the door lock with a keypad

In the following image, we see a keypad with a lock. This section can be merged along with the last project. This device can be controlled from your Raspberry Pi Zero or your Arduino board:

Controlling the door lock with a keypad

 Code to access using the keypad

You can now either copy the code inside a file called Project_keyboard_Access_Control.ino, or just get the complete code from the folder for this project using the Arduino IDE:

void captura() { tecla = customKeypad.getKey(); if (tecla) { digito = digito + 1; if(tecla==35){tecla=0;digito=0;valorf=0;lcd.setCursor(0,0);lcd.print(valorf); lcd.print(" ");} if(tecla==48){tecla=0;} if(tecla==42){tecla=0;digito=0;valor ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required