I took your advice and picked up a leonardo and got the keys to type if I short across D3 to 5v as per a sketch i found online.
See sketch below
/*
Keyboard Button test
Sends a text string when a button is pressed.
The circuit:
- pushbutton attached from pin 3 to +5V
- 10-kilohm resistor attached from pin 3 to ground
created 24 Oct 2011
by Tom Igoe
This example code is in the public domain.
*/
// Set the input to be the Hall-effect sensor
const int buttonPin = 3; // input pin for pushbutton
int previousButtonState = HIGH; // for checking the state of a pushButton
int counter = 0; // button push counter
void setup() {
// make the pushButton pin an input:
pinMode(buttonPin, INPUT);
}
void loop() {
// Read the StealthDuino! Hall-effect sensor, or just pin3 on an ordinary board
int buttonState = digitalRead(buttonPin);
// if the button state has changed,
if ((buttonState != previousButtonState)
// and it's currently pressed:
&& (buttonState == HIGH)) {
// increment the button counter
counter++;
// type out a message
// First function types a capital "Y" (ACSCII code 89)
Keyboard.write(89);
Keyboard.print("ou pressed the button: ");
Keyboard.print(counter);
Keyboard.println(" times.");
Keyboard.println("");
}
// save the current button state for comparison next time:
previousButtonState = buttonState;
}
i want to switch this so that the activation is via a pir not shorting across pins. How would I need to adjust this sketch
Also i want to activate a function key one time and then reset it to look for motion again and trigger the function key only when motion is sensed
how would that sketch be implemented
thanks in advance for all the help