Créer un Clavier/Souris avec un Arduino

Vidéo

Liste des Composants

Arduino Leonardo- Amazon

Arduino Pro Micro – Amazon

Résistance – Amazon

Le Schéma

Les Touches Clavier

Le Code

//------------------------------------------------------
//                https://gammatroniques.fr/
//                  Code Arduino Leonardo
//              02/2021 - by GammaTroniques
//------------------------------------------------------
#include <Arduino.h>
#include <Mouse.h>
#include <Keyboard.h>

String fr2en(String text)
{
  int i = 0;
  String _en = " =qwertyuiopasdfghjkl;zxcvbnQWERTYUIOPASDFGHJKL:ZXCVBNm,./M<>?1234567890!@#$%^&*()";
  String fr = " =azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN,;:!?./ & (-   1234567890";
  String str = "";
  while (text[i] != 0)
  {
    str = str + (String)_en[fr.indexOf((String)text[i++])];
  }
  return str;
}

const int pinB = 2;

void setup()
{
  Keyboard.begin();
  Mouse.begin();
  pinMode(pinB, INPUT);
}

void loop()
{
  if (!digitalRead(pinB))
  {
    Keyboard.press(KEY_LEFT_CTRL);
    Keyboard.press('t');
    delay(50);
    Keyboard.releaseAll();
    delay(100);
    Keyboard.println(fr2en("https://gammatroniques.fr/"));
    delay(5000);
    Mouse.move(0, 0, -10);
    Mouse.press(MOUSE_);
    Mouse.isPressed
  }
  else
  {
  }
}