heres my phukducky.. designed to be modular, and capable of doing a lot.
hopefully easy code to read
if you create any modules/snipits or have inprovements please chuck me an email
I will hopefully be updating this soon,
literally got my teensy 12 hrs ago and made this
also soldered on a dip switch to pins 14 - 21 (analog)
this will perform 1 module at a time but capable of doing up to 128 :S .. early.. math bad
if you have any questions, please post them below
void setup() {
pinMode(11, OUTPUT);
pinMode(14, INPUT_PULLUP); // Dip - debug switch
pinMode(15, INPUT_PULLUP); // Dip
pinMode(16, INPUT_PULLUP); // Dip
pinMode(17, INPUT_PULLUP); // Dip
pinMode(18, INPUT_PULLUP); // Dip
pinMode(19, INPUT_PULLUP); // Dip
pinMode(20, INPUT_PULLUP); // Dip
pinMode(21, INPUT_PULLUP); // Dip
}
void loop(){
delay(4000);
int pin_struct[] = { 0, 200, 64, 32, 16, 8, 4, 2, 1 };
int multiplier = 0;
int binary = 0;
char* description[500];
description[0] = "\r-----end-----\r"
"Phukducky 1.0 By NanoyMaster\r"
"For help/support/documentation Please visit http://www.nanoy.org\r"
"Designed to be Modular and Easy.\r"
"Feel free to email nanoymaster[at]gmail[dot]com";
description[1] = "CrazyMouse - moves and clicks mouse randomly\r";
description[2] = "end"; // need to keep the last one as "end"
for(int thispin=14; thispin < 22;thispin++){ // get the binary value (including debug bit)
if(!digitalRead(thispin)){
digitalWrite(ledPin, HIGH);
multiplier = thispin - 13;
binary = binary + (1 * pin_struct[multiplier]);
}
}
if(binary >= 200 ){ // if debuging enabled then run debug
delay(3000);
Keyboard.print("\rDIP Binary = "); Keyboard.print(binary - 200);
for(int debugno=1; debugno <=129; debugno++){
if(description[debugno] != "end"){
Keyboard.print(debugno); Keyboard.print(") ");
Keyboard.print(description[debugno]);
delay(1000);
}else{
Keyboard.print(description[0]);
die();
}
}
}
// main program functions go here
if(binary == 1){
Mouse.move(random(-100, 100) ,random(-100, 100) );
Mouse.click();
}
// end main functions
}
void die(){ // failsafe... if you need to exit the main loop, or just want to run once
while(1){
digitalWrite(ledPin, LOW);
delay(250);
digitalWrite(ledPin, HIGH);
delay(250);
}
}
as you can see you just have to add modules under main functions and add the description in the descriptions section.