> For the complete documentation index, see [llms.txt](https://glafargue.gitbook.io/it-i2d/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://glafargue.gitbook.io/it-i2d/arduino-and-appinventor/activites-appinventor/arduino-a-android-par-bluetooth.md).

# Arduino à Android par Bluetooth

![](/files/-M-_cJUldUpGiT2-PZKo)

***Matériel :***

* *Arduino Uno*
* *shield Grove*
* *module Grove Serial Bluetooth v3*
* *bouton-poussoir Grove*
* *Smartphone sous Android*

## Présentation&#x20;

On souhaite établir une liaison sene Bluetooth entre une carte Arduino Uno et un smartphone/tablette sous Android :

* la carte Arduino enverra une information au téléphone en fonction

  de l'état d'un BP ;
* le téléphone recevra cette information grâce à une application

  dédiée, réalisée sous Applnventor.

## Arduino

NB: le module Serial Bluetooth v3 devra être connecté au port UART (Universal Asynchronous Receiver Transmitter). **Il doit être ôté lors de chaque téléversement**

1. Connectez un BP en D5. *Ne connectez pas le module Bluetooth V3 à la carte Arduino.*
2. Collez le contenu suivant dans un onglet vierge et envoyez-le vers la carte (et enregistrez le fichier sous le nom « TP105.ino »). Une fois le téléversement terminé, connectez le module Bluetooth sur le port UART.&#x20;
3. Établissez l'algorigramme du programme Arduino.

```cpp
byte buttonState;

void setup()
{
  Serial.begin(9600);
  pinMode(5, INPUT);
}

void loop()
{
  buttonState = digitalRead(5);
  if (buttonState == HIGH)
  {
    Serial.println("Button pressed");
  }
  else
  {
    Serial.println("Button released");
  }
  delay(300);
}
```

## **Android**

1. Sous Applnventor (<http://appinventor.mit.edu>), saisissez le design fourni en annexe 1 ( ou à peu près).
2. Ajustez le « Timerlnterval » du composant « Clockl » à 300 ms. À quoi sert un composant « Clock » ?
3. Sous Applnventor, saisissez les blocs fournis en annexe 2 et expliquez le rôle de chacun.

## Système final&#x20;

1. Compilez le programme pour générer un fichier APK, téléchargez l'application via un QR code puis ... testez-la!

## Annexes

{% file src="/files/-M-VnEicSFfCJBOQvoRj" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://glafargue.gitbook.io/it-i2d/arduino-and-appinventor/activites-appinventor/arduino-a-android-par-bluetooth.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
