Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <keyboard.h>
- //Pin layout here
- const int buttonPin = 0;
- const int buttonPin2 = 1;
- const int buttonPin3 = 2;
- const int buttonPin4 = 3;
- const int buttonPin5 = 4;
- const int buttonPin6 = 5;
- int buttonState = 0;
- int buttonState2 = 0;
- int buttonState3 = 0;
- int buttonState4 = 0;
- int buttonState5 = 0;
- int buttonState6 = 0;
- //LED light
- int led = 11;
- void setup(){
- pinMode(buttonPin, INPUT_PULLUP);
- pinMode(buttonPin2, INPUT_PULLUP);
- pinMode(buttonPin3, INPUT_PULLUP);
- pinMode(buttonPin4, INPUT_PULLUP);
- pinMode(buttonPin5, INPUT_PULLUP);
- pinMode(buttonPin6, INPUT_PULLUP);
- pinMode(led, OUTPUT);
- }
- void loop(){
- //this is the led light control
- digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
- delay(300); // wait for a second
- digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
- delay(100);
- buttonState = digitalRead(buttonPin);
- buttonState2 = digitalRead(buttonPin2);
- buttonState3 = digitalRead(buttonPin3);
- buttonState4 = digitalRead(buttonPin4);
- buttonState5 = digitalRead(buttonPin5);
- buttonState6 = digitalRead(buttonPin6);
- //this is for Save As...
- if (buttonState == LOW){
- Keyboard.set_modifier(MODIFIERKEY_CTRL);
- Keyboard.send_now();
- Keyboard.set_modifier(MODIFIERKEY_CTRL | MODIFIERKEY_SHIFT);
- Keyboard.send_now();
- Keyboard.set_key1(KEY_S);
- Keyboard.send_now();
- }
- if (buttonState == HIGH){
- Keyboard.set_modifier(0);
- Keyboard.set_key1(0);
- Keyboard.send_now();
- }
- //This will be for Brush Tool [B]
- if (buttonState2 == LOW){
- Keyboard.set_key2(KEY_B);
- Keyboard.send_now();
- }
- if (buttonState2 == HIGH){
- Keyboard.set_key2(0);
- Keyboard.send_now();
- }
- // Eraser Tool [E]
- if (buttonState3 == LOW){
- Keyboard.set_key3(KEY_E);
- Keyboard.send_now();
- }
- if (buttonState3 == HIGH){
- Keyboard.set_key3(0);
- Keyboard.send_now();
- }
- //Hand Tool
- if (buttonState4 == LOW){
- Keyboard.set_key4(KEY_SPACE);
- Keyboard.send_now();
- }
- if (buttonState4 == HIGH){
- Keyboard.set_key4(0);
- Keyboard.send_now();
- }
- if (buttonState5 == LOW){
- Keyboard.set_key5(KEY_H);
- Keyboard.send_now();
- }
- if (buttonState5 == HIGH){
- Keyboard.set_key5(0);
- Keyboard.send_now();
- }
- if (buttonState6 == LOW){
- //Undo Command
- Keyboard.set_modifier(MODIFIERKEY_CTRL);
- Keyboard.send_now();
- //Keyboard.set_modifier(MODIFIERKEY_CTRL | MODIFIERKEY_SHIFT);
- //Keyboard.send_now();
- Keyboard.set_key6(KEY_Z);
- Keyboard.send_now();
- }
- if (buttonState6 == HIGH){
- Keyboard.set_modifier(0);
- Keyboard.set_key6(0);
- Keyboard.send_now();
- }
- delay(2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement