Clavier tactile avec un Arduino ?

Bonjour les gens !

Pensez-vous qu'il est possible d'utiliser un Arduino + Ecran tactile comme ça :

Pour en faire un clavier personnalisé compatible Android ?

En gros ce que je souhaiterai faire c'est un écran externe que je puisse relier en USB (voire en bluetooth) à un tablette pour pouvoir lui envoyer des signaux comme ceux d'un clavier (genre volume, play, etc. etc.).
Concrètement j'appuie sur une icône PLAY sur l'écran et l'Arduino envoie PLAY à mon Android.

Faisable ?

Bonjour,
Oui, il le peut. :grin:

Ok merci.
Et par le plus grand des hasards, est-ce que le code existe déjà ?
J'ai cherché un peu mais rien trouvé de concret.

:slight_smile:

Hello !

J'ai reçu mon Arduino et j'essaye de faire un test tout con pour voir si j'arrive à envoyer un bouton (ou n'importe quoi d'autre) à mon Android.
Mais lorsque j'essaye de compiler mon code j'ai le message d'erreur suivant :

error: 'Keyboard' was not declared in this scope

Pourtant si j'en crois cette page : http://www.arduino.cc/en/Tutorial/KeyboardMessage
Il n'y a rien à faire hormis mettre un Keyboard.begin(); dans le setup.
Pas d'include ou quoi que ce soit d'autre.

Une idée de ce qui peut bloquer ?

Essaye ça :
// UTFT_Buttons_Demo_320x240 (C)2013 Henning Karlsen
// web: Electronics - Henning Karlsen
//
// A small demo to demonstrate the use of some of the
// functions of the UTFT_Buttons add-on library.
//
// This demo was made for modules with a screen resolution
// of 320x240 pixels, but should work on larger screens as
// well.
//
// This program requires both the UTFT and UTouch libraries
// in addition to the UTFT_Buttons add-on library.
//

#include <UTFT.h>
#include <UTouch.h>
#include <UTFT_Buttons.h>

// Declare which fonts we will be using
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t Dingbats1_XL[];

// Set up UTFT...
// Set the pins to the correct ones for your development board
// -----------------------------------------------------------
// Standard Arduino 2009/Uno/Leonardo shield : ,19,18,17,16
// Standard Arduino Mega/Due shield : ,38,39,40,41
// CTE TFT LCD/SD Shield for Arduino Due : ,25,26,27,28
// Standard chipKit Uno32/uC32 : ,34,35,36,37
// Standard chipKit Max32 : ,82,83,84,85
// AquaLEDSource All in One Super Screw Shield : ,82,83,84,85
//
// Remember to change the model parameter to suit your display module!
UTFT myGLCD(ITDB32S,38,39,40,41);

// Set up UTouch...
// Set the pins to the correct ones for your development board
// -----------------------------------------------------------
// Standard Arduino 2009/Uno/Leonardo shield : 15,10,14,9,8
// Standard Arduino Mega/Due shield : 6,5,4,3,2
// CTE TFT LCD/SD Shield for Arduino Due : 6,5,4,3,2
// Standard chipKit Uno32/uC32 : 20,21,22,23,24
// Standard chipKit Max32 : 62,63,64,65,66
// AquaLEDSource All in One Super Screw Shield : 62,63,64,65,66
UTouch myTouch(6,5,4,3,2);

// Finally we set up UTFT_Buttons :slight_smile:
UTFT_Buttons myButtons(&myGLCD, &myTouch);

void setup()
{
myGLCD.InitLCD();
myGLCD.clrScr();
myGLCD.setFont(SmallFont);

myTouch.InitTouch();
myTouch.setPrecision(PREC_MEDIUM);

myButtons.setTextFont(BigFont);
myButtons.setSymbolFont(Dingbats1_XL);
}

void loop()
{
int but1, but2, but3, but4, butX, butY, pressed_button;
boolean default_colors = true;

but1 = myButtons.addButton( 10, 20, 300, 30, "Button 1");
but2 = myButtons.addButton( 10, 60, 300, 30, "Button 2");
but3 = myButtons.addButton( 10, 100, 300, 30, "Button 3");
but4 = myButtons.addButton( 10, 140, 300, 30, "Button 4", BUTTON_DISABLED);
butX = myButtons.addButton(279, 199, 40, 40, "a", BUTTON_SYMBOL);
butY = myButtons.addButton( 0, 199, 100, 40, "I", BUTTON_SYMBOL | BUTTON_SYMBOL_REP_3X);
myButtons.drawButtons();

myGLCD.print("You pressed:", 110, 205);
myGLCD.setColor(VGA_BLACK);
myGLCD.setBackColor(VGA_WHITE);
myGLCD.print("None ", 110, 220);

while(1)
{
if (myTouch.dataAvailable() == true)
{
pressed_button = myButtons.checkButtons();

if (pressed_button==butX)
{
if (myButtons.buttonEnabled(but4))
myButtons.disableButton(but4, true);
else
myButtons.enableButton(but4, true);
}
else if (pressed_button==butY)
{
if (default_colors)
{
myButtons.setButtonColors(VGA_YELLOW, VGA_RED, VGA_YELLOW, VGA_BLUE, VGA_GRAY);
myButtons.relabelButton(butY, "_");
myButtons.drawButtons();
default_colors=false;
}
else
{
myButtons.setButtonColors(VGA_WHITE, VGA_GRAY, VGA_WHITE, VGA_RED, VGA_BLUE);
myButtons.relabelButton(butY, "I");
myButtons.drawButtons();
default_colors=true;
}
}
if (pressed_button==but1)
myGLCD.print("Button 1", 110, 220);
if (pressed_button==but2)
myGLCD.print("Button 2", 110, 220);
if (pressed_button==but3)
myGLCD.print("Button 3", 110, 220);
if (pressed_button==but4)
myGLCD.print("Button 4", 110, 220);
if (pressed_button==-1)
myGLCD.print("None ", 110, 220);
}
}
}

Merci mais c'est exactement le code que j'ai testé :smiley: ! Il fonctionne bien d'ailleurs.
Ce qui bloque c'est que je ne peux pas utiliser le "Keyboard". Du coup après avoir fouillé sur le net je me demande si la carte Arduino MEGA peut servir de clavier HID :frowning: ...

Le Keyboard ?
clavier HID ?

C'est un peu normal que ça ne marche pas c'est pour les Arduino Leonardo, Micro, ou Due

These core libraries allow an Arduino Leonardo, Micro, or Due board to appear as a native Mouse and/or Keyboard to a connected computer.

voir là:http://www.arduino.cc/en/Reference/MouseKeyboard

Ok tant pis :(.