this is for a bios password that i need. i have the code working for entering the codes (4 digit) but need it to log the last code entered or all codes entered. i cant seem to figure out how to code that. im using a teensy 3.0, thats why the led is on that pin thanks!
#include <usb_keyboard.h>
const int ledPin = 13; // choose the pin for the LED
int counter = 0;
int fakecounter = counter;
char pin[]="xxxx";
void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
delay(10000);
}
void loop(){
keyboard_modifier_keys = 0;
if (counter <= 9999){
delay(8000);
digitalWrite(ledPin, LOW);
delay(5500);
digitalWrite(ledPin, HIGH);
sprintf(pin, "%04d", fakecounter);
//sending first digit
Keyboard.press(pin[0]);
delay(450);
Keyboard.release(pin[0]);
delay(420);
//sending second digit
Keyboard.press(pin[1]);
delay(398);
Keyboard.release(pin[1]);
delay(510);
//sending third digit
Keyboard.press(pin[2]);
delay(421);
Keyboard.release(pin[2]);
delay(423);
//sending forth digit
Keyboard.press(pin[3]);
delay(430);
Keyboard.release(pin[3]);
delay(525);
//sending enter
Keyboard.press(KEY_ENTER);
delay(305);
Keyboard.release(KEY_ENTER);
}
//reached 4 digit PIN max value
if (counter > 9999){
for (int blinkies = 0; blinkies < 8; blinkies++) {
digitalWrite(ledPin, HIGH);
delay(20);
digitalWrite(ledPin, LOW);
delay(200);
}
delay(6000);
}
++counter;
fakecounter = counter;
}
nhoj_yelbom:
need it to log the last code entered or all codes entered
Log where/how?
Please format your code properly - it is very difficult to read as you have posted it and frankly I'm not going to bother trying to make sense of it. You can use Tools / Autoformat to indent the code.
nhoj_yelbom:
need it to log the last code entered or all codes entered
Log where/how?
Please format your code properly - it is very difficult to read as you have posted it and frankly I'm not going to bother trying to make sense of it. You can use Tools / Autoformat to indent the code.
sorry i did not write the code. i want the correct pin to be remembered or a log of all the pins entered
i used auto format on it below
#include <usb_keyboard.h>
const int ledPin = 13; // choose the pin for the LED
int counter = 0;
int fakecounter = counter;
char pin[]="xxxx";
void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
delay(10000);
}
void loop(){
keyboard_modifier_keys = 0;
if (counter <= 9999){
delay(8000);
digitalWrite(ledPin, LOW);
delay(5500);
digitalWrite(ledPin, HIGH);
sprintf(pin, "%04d", fakecounter);
//sending first digit
Keyboard.press(pin[0]);
delay(450);
Keyboard.release(pin[0]);
delay(420);
//sending second digit
Keyboard.press(pin[1]);
delay(398);
Keyboard.release(pin[1]);
delay(510);
//sending third digit
Keyboard.press(pin[2]);
delay(421);
Keyboard.release(pin[2]);
delay(423);
//sending forth digit
Keyboard.press(pin[3]);
delay(430);
Keyboard.release(pin[3]);
delay(525);
//sending enter
Keyboard.press(KEY_ENTER);
delay(305);
Keyboard.release(KEY_ENTER);
}
//reached 4 digit PIN max value
if (counter > 9999){
for (int blinkies = 0; blinkies < 8; blinkies++) {
digitalWrite(ledPin, HIGH);
delay(20);
digitalWrite(ledPin, LOW);
delay(200);
}
delay(6000);
}
++counter;
fakecounter = counter;
}
Thanks for formatting the code better. What do you mean by "remembered" or "logged"? Bear in mind that the possibilities are almost endless and unless you say what you want it to do the list of possible solutions is similarly endless.
Do you just want one value, or multiple values? Does your sketch know which value/values you want, and if so how? Where/how do you want to access these values? Are you going to display them somewhere - if so, where?
the code works as-is. basically it enters the four digit code and then enter. i want it to remember the correct code entered or the last code entered (same result)
I need a help , i use a script of orvtech with Teensy 3.1 it's ok but i modded the script to add a LCD (HD44780).
The test of script "Hello World" demonstrate the mounting work perfectly...
When i use this script...in the LCD...the result display is following a number (XXXX) of end !
exemple ( 0000 => 0 ; 0001 => 1 ; 0002 =>2 ....)
I want to print the result of this counting...whent the Teensy write 0000 in LCD print 0000
LCD R/W pin to ground
*/
// Taken from http://darcade.de/electronics/connecting-teensy-3-0-lcd-hd44780-display
// The next line sets pins to use on Teensy 3.0 ***Note: I changed pin assignment from above website post on last 2 pins so ovrtechs code still use pin 13 for LED
LiquidCrystal lcd(23, 22, 16, 15, 14, 13);
//MODDED By ME To Add LCD
const int ledPin = 13; // choose the pin for the LED
int counter = 0;
int fakecounter = counter;
char pin[]="xxxx";
void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
delay(10000);
//MODDED By ME To Add LCD
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Ex. set the cursor to column 0, line 1
// Ex. (note: line 1 is the second row, since counting begins with 0):
// Ex. lcd.setCursor(0, 1);
// Hopefully next command prints characters on 1st row starting at 1st Position
lcd.setCursor(6, 0);
//MODDED By ME To Add LCD
// Print a message to the LCD.
// Hopefully prints value in counter?
lcd.print(counter);
//MODDED By ME To Add LCD
}
void loop(){
if (counter <= 9999){
digitalWrite(ledPin, LOW);
delay(5500);
digitalWrite(ledPin, HIGH);
delay( 500);
sprintf(pin, "%04d", fakecounter); //Serial.print(pin);
Keyboard.print(pin[0]);
delay(300);
Keyboard.print(pin[1]);
delay(300);
Keyboard.print(pin[2]);
delay(300);
Keyboard.println(pin[3]);
}
//reached 4 digit PIN max value
if (counter > 9999){
for (int blinkies = 0; blinkies < 8; blinkies++) {
digitalWrite(ledPin, HIGH);
delay(20);
digitalWrite(ledPin, LOW);
delay(200);
}
delay(6000);
}
++counter;
fakecounter = counter;
}