
Le shield Joystick Funduino comporte :
-
1 joystick deux axes délivrant deux tensions analogiques.
-
4 gros boutons poussoirs.
-
2 petits boutons poussoirs.
-
1 commutateur permettant de basculer le fonctionnement en 3,3 ou 5 V.
-
1 connecteur permettant d'accueillir un module fonctionnant en I2C entouré en ORANGE.
-
1 connecteur permettant d'accueillir un module radiofréquence nRF24L01 entouré en JAUNE.
-
1 connecteur permettant d'accueillir un module LCD Nokia 5110 entouré en VERT.
-
1 connecteur permettant d'accueillir un module Bluetooth HC06 entouré en BLEU.
LE SHIELD JOYSTICK FUNDUINO

Exemple :
Nous souhaitons afficher dans le moniteur série les valeurs X et Y du joystick et l'état des 6 boutons A, B, C, D, E et F.
Liste du matériel :
-
1 Arduino Uno
-
1 shield Joystick Funduino
Programme :
/* Shield_Joystick est un programme qui affiche les valeurs du joystick et l'état des boutons poussoirs dans le moniteur série*/
#define bouton_A 2 // déclaration des broches
#define bouton_B 3
#define bouton_C 4
#define bouton_D 5
#define bouton_E 6
#define bouton_F 7
#define bouton_joystick 8
#define joystick_X A0
#define joystick_Y A1
void setup()
{
for (int i=2; i <= 8; i++)
{
pinMode(i, INPUT_PULLUP); // les broches 2 à 8 sont en entrée avec une résistance de tirage
}
Serial.begin(9600); // initialisation du moniteur série
}
void loop()
{
if(digitalRead(bouton_A) == LOW)
{
Serial.println("Le bouton A est actif");
}
if(digitalRead(bouton_B) == LOW)
{
Serial.println("Le bouton B est actif");
}
if(digitalRead(bouton_C) == LOW)
{
Serial.println("Le bouton C est actif");
}
if(digitalRead(bouton_D) == LOW)
{
Serial.println("Le bouton D est actif");
}
if(digitalRead(bouton_E) == LOW)
{
Serial.println("Le bouton E est actif");
}
if(digitalRead(bouton_F) == LOW)
{
Serial.println("Le bouton F est actif");
}
if(digitalRead(bouton_F) == LOW)
{
Serial.println("Le bouton F est actif");
}
if(digitalRead(bouton_joystick) == LOW)
{
Serial.println("Le bouton joystick est actif");
}
Serial.print("X: ");
Serial.println(analogRead(joystick_X));
Serial.print("Y: ");
Serial.println(analogRead(joystick_Y));
delay(500); // on attend 500 ms
}
Ce shield utilise les 13 broches numériques d'une carte Arduino Uno et 4 broches analogiques. Cela n'est pas négligeable !!!


Le brochage du module LCD Nokia 5110 existe sous plusieurs formes. Il est donc impératif de respecter le brochage imposé par le skield Joystick sous peine de destruction du module LCD.
