Giter Site home page Giter Site logo

Comments (2)

Maxsteff57 avatar Maxsteff57 commented on June 11, 2024

Code for atmega

#include "Keyboard.h"
#include <SD.h>
#include <string.h>
#include <SPI.h>
File script;
boolean first = true;
String DEFAULT_FILE_NAME = "script.txt"; void setup() { if (!SD.begin(4)) { return; } script = SD.open(DEFAULT_FILE_NAME); if (script) { Keyboard.begin(); String line = ""; while (script.available()) { char m = script.read(); if (m == '\n'){ Line(line); line = ""; } else if((int) m != 13) { line += m; } } Line(line); script.close(); } else { } Keyboard.end();
} void Line(String l)
{ int space_1 = l.indexOf(" "); if (space_1 == -1) { Press(l); } else if (l.substring(0,space_1) == "STRING") { Keyboard.print(l.substring(space_1 + 1)); } else if (l.substring(0,space_1) == "DELAY") { int delaytime = l.substring(space_1 + 1).toInt(); delay(delaytime); } else if(l.substring(0,space_1) == "REM"){} else { String remain = l; while(remain.length() > 0) { int latest_space = remain.indexOf(" "); if (latest_space == -1) { Press(remain); remain = ""; } else { Press(remain.substring(0, latest_space)); remain = remain.substring(latest_space + 1); } delay(5); } } Keyboard.releaseAll();
} void Press(String b)
{ if(b.length() == 1) { char c = b[0]; Keyboard.press(c); } else if (b.equals("ENTER")) { Keyboard.press(KEY_RETURN); } else if (b.equals("CTRL")) { Keyboard.press(KEY_LEFT_CTRL); } else if (b.equals("SHIFT")) { Keyboard.press(KEY_LEFT_SHIFT); } else if (b.equals("ALT")) { Keyboard.press(KEY_LEFT_ALT); } else if (b.equals("GUI")) { Keyboard.press(KEY_LEFT_GUI); } else if (b.equals("NUMLOCK")) { Keyboard.press(219); } else if (b.equals("UP") || b.equals("UPARROW")) { Keyboard.press(KEY_UP_ARROW); } else if (b.equals("DOWN") || b.equals("DOWNARROW")) { Keyboard.press(KEY_DOWN_ARROW); } else if (b.equals("LEFT") || b.equals("LEFTARROW")) { Keyboard.press(KEY_LEFT_ARROW); } else if (b.equals("RIGHT") || b.equals("RIGHTARROW")) { Keyboard.press(KEY_RIGHT_ARROW); } else if (b.equals("DELETE")) { Keyboard.press(KEY_DELETE); } else if (b.equals("PAGEUP")) { Keyboard.press(KEY_PAGE_UP); } else if (b.equals("PAGEDOWN")) { Keyboard.press(KEY_PAGE_DOWN); } else if (b.equals("HOME")) { Keyboard.press(KEY_HOME); } else if (b.equals("ESC")) { Keyboard.press(KEY_ESC); } else if (b.equals("INSERT")) { Keyboard.press(KEY_INSERT); } else if (b.equals("TAB")) { Keyboard.press(KEY_TAB); } else if (b.equals("END")) { Keyboard.press(KEY_END); } else if (b.equals("CAPSLOCK")) { Keyboard.press(KEY_CAPS_LOCK); } else if (b.equals("F1")) { Keyboard.press(KEY_F1); } else if (b.equals("F2")) { Keyboard.press(KEY_F2); } else if (b.equals("F3")) { Keyboard.press(KEY_F3); } else if (b.equals("F4")) { Keyboard.press(KEY_F4); } else if (b.equals("F5")) { Keyboard.press(KEY_F5); } else if (b.equals("F6")) { Keyboard.press(KEY_F6); } else if (b.equals("F7")) { Keyboard.press(KEY_F7); } else if (b.equals("F8")) { Keyboard.press(KEY_F8); } else if (b.equals("F9")) { Keyboard.press(KEY_F9); } else if (b.equals("F10")) { Keyboard.press(KEY_F10); } else if (b.equals("F11")) { Keyboard.press(KEY_F11); } else if (b.equals("F12")) { Keyboard.press(KEY_F12); } else if (b.equals("N9")) { Keyboard.press (233); Keyboard.release (233); } else if (b.equals("N8")) { Keyboard.press (232); Keyboard.release (232); } else if (b.equals("N7")) { Keyboard.press (231); Keyboard.release (231); } else if (b.equals("N6")) { Keyboard.press (230); Keyboard.release (230); } else if (b.equals("N5")) { Keyboard.press (229); Keyboard.release (229); } else if (b.equals("N4")) { Keyboard.press (228); Keyboard.release (228); } else if (b.equals("N3")) { Keyboard.press (227); Keyboard.release (227); } else if (b.equals("N2")) { Keyboard.press (226); Keyboard.release (226); } else if (b.equals("N1")) { Keyboard.press (225); Keyboard.release (225); } else if (b.equals("N0")) { Keyboard.press (234); Keyboard.release (234); }
} void loop() {} 

Encoder:

convert = { 'A': 'ALT N6 N5', 'B': 'ALT N6 N6', 'C': 'ALT N6 N7', 'D': 'ALT N6 N8', 'E': 'ALT N6 N9', 'F': 'ALT N7 N0', 'G': 'ALT N7 N1', 'H': 'ALT N7 N2', 'I': 'ALT N7 N3', 'J': 'ALT N7 N4', 'K': 'ALT N7 N5', 'L': 'ALT N7 N6', 'M': 'ALT N7 N7', 'N': 'ALT N7 N8', 'O': 'ALT N7 N9', 'P': 'ALT N8 N0', 'Q': 'ALT N8 N1', 'R': 'ALT N8 N2', 'S': 'ALT N8 N3', 'T': 'ALT N8 N4', 'U': 'ALT N8 N5', 'V': 'ALT N8 N6', 'W': 'ALT N8 N7', 'X': 'ALT N8 N8', 'Y': 'ALT N8 N9', 'Z': 'ALT N9 N0', 'a': 'ALT N9 N7', 'b': 'ALT N9 N8', 'c': 'ALT N9 N9', 'd': 'ALT N1 N0 N0', 'e': 'ALT N1 N0 N1', 'f': 'ALT N1 N0 N2', 'g': 'ALT N1 N0 N3', 'h': 'ALT N1 N0 N4', 'i': 'ALT N1 N0 N5', 'j': 'ALT N1 N0 N6', 'k': 'ALT N1 N0 N7', 'l': 'ALT N1 N0 N8', 'm': 'ALT N1 N0 N9', 'n': 'ALT N1 N1 N0', 'o': 'ALT N1 N1 N1', 'p': 'ALT N1 N1 N2', 'q': 'ALT N1 N1 N3', 'r': 'ALT N1 N1 N4', 's': 'ALT N1 N1 N5', 't': 'ALT N1 N1 N6', 'u': 'ALT N1 N1 N7', 'v': 'ALT N1 N1 N8', 'w': 'ALT N1 N1 N9', 'x': 'ALT N1 N2 N0', 'y': 'ALT N1 N2 N1', 'z': 'ALT N1 N2 N2', ',': 'ALT N4 N4', '.': 'ALT N4 N6', '/': 'ALT N4 N7', '<': 'ALT N6 N0', '>': 'ALT N6 N2', '?': 'ALT N6 N3', ';': 'ALT N5 N9', ':': 'ALT N5 N8', '"': 'ALT N3 N4', '[': 'ALT N9 N1', ']': 'ALT N9 N3', '{': 'ALT N1 N2 N3', '}': 'ALT N1 N2 N5',} stEng = input("Input text: ")
i = 0
f = 0
otvet = []
for k in stEng: try: print(convert[stEng[i]]) i += 1 except KeyError: print('STRING',k) i += 1

from rucky.

mayankmetha avatar mayankmetha commented on June 11, 2024

Hold option is part of rubber ducky 3.0 which is still under development.

from rucky.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.