Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Westpol
Published

Password Typer

This is like the password saver, just that it is not only saving the password, but writing it on the chosen line.

IntermediateFull instructions provided3,981
Password Typer

Things used in this project

Story

Read more

Code

Password_Typer.ino

C/C++
I think the code is pretty self explaining.
#include <LiquidCrystal.h>
#include <Keyboard.h>

const int rs = 7, en = 8, d4 = 9, d5 = 10, d6 = 11, d7 = 12;    // change to your pins of the arduino
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);                      // the settings for the lcd 

int menu;
int PrevMenuState;

int IMPORTANTJUMPER = 3;
int button = 2;    // the pin, which the button is attached on
/* For the analog input, I couldn't use a variable, because of the A for analog,
so you have to correct some lines
the lines are:22,29 */

int passwords = 2;  // numbers of passwords/accounts

void setup() {
  lcd.begin(16, 2);     // sets the type of lcd
  lcd.clear();          // clears the lcd
  
  Serial.begin(9600);
  pinMode(IMPORTANTJUMPER,INPUT_PULLUP);
  pinMode(button,INPUT_PULLUP);
  pinMode(A6,INPUT);
  PrevMenuState = 2;
  
}

void loop() {
  
  while (digitalRead(IMPORTANTJUMPER) == HIGH) {
    // do nothing until IMPORTANTJUMPER pin goes low
    Keyboard.end();
    delay(500);
  }
  
  menu = map(analogRead(A6),0,1024,0,passwords);   // converts the 1024 steps into tinier steps

  if(menu != PrevMenuState){

  lcd.clear();

    
    if(menu == 0){
      lcd.print("Your account which the password is for1");    
      
    }
    if(menu == 1){
      lcd.print("Your account which the password is for2");    
    }
/*    if(menu == 2){    // for 3 accounts just undo the block comment and add 1 to the passwords int
      Serial.println("Your account which the password is for3");    
    }*/
     PrevMenuState = menu;
     
  }




  if(digitalRead(button) == LOW){
    if(menu == 0){
      Keyboard.print("password1"); 
      while(digitalRead(button) == LOW){}
    }
    if(menu == 1){
      Keyboard.print("password2 ");    
      while(digitalRead(button) == LOW){}
    }
/*    if(menu == 2){
      Keyboard.print("password3 ");    /    // for 3 accounts just undo the block comment and add 1 to the passwords int
      while(digitalRead(button) == LOW){}
        
    }*/
    
  }
  
}

Credits

Westpol
8 projects • 22 followers
Contact

Comments

Please log in or sign up to comment.