allumer_une_led_via_bluetooth
Différences
Ci-dessous, les différences entre deux révisions de la page.
allumer_une_led_via_bluetooth [2017/05/07 14:18] – créée simon | allumer_une_led_via_bluetooth [Date inconnue] (Version actuelle) – supprimée - modification externe (Date inconnue) 127.0.0.1 | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | ====== Allumer une led via bluetooth ====== | ||
- | Suite à la découverte du module bluetooth [[tel0026]], | ||
- | ===== Mise en place ===== | ||
- | * Arduino " | ||
- | * Une [[https:// | ||
- | * Avec un [[https:// | ||
- | * Sur lequel on met un [[https:// | ||
- | |||
- | * Arduino " | ||
- | * Une [[https:// | ||
- | * Avec un [[https:// | ||
- | * Sur lequel on met une [[https:// | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **TODO:** Ajouter photos! | ||
- | </ | ||
- | |||
- | ===== Programme " | ||
- | <code c> | ||
- | /* Minimal code for testing bluetooth module TEL0026 with a button | ||
- | |||
- | This program must be used with " | ||
- | |||
- | The circuit is based on Dreamer Nano V4.1, compatible Arduino Leonardo ( https:// | ||
- | TEL0026 and button are plugged on Nano I/O Shield ( https:// | ||
- | |||
- | Created 2017 by Simon Lefort. | ||
- | */ | ||
- | |||
- | int buttonPin = 8; //button is on pin 8 | ||
- | |||
- | void setup() { | ||
- | Serial.begin(38400); | ||
- | Serial1.begin(38400); | ||
- | } | ||
- | |||
- | void loop() { | ||
- | int val = digitalRead(buttonPin); | ||
- | delay(50); | ||
- | | ||
- | if (val == HIGH) { | ||
- | Serial1.print(" | ||
- | // | ||
- | } | ||
- | else | ||
- | { | ||
- | // | ||
- | } | ||
- | } | ||
- | </ | ||
- | |||
- | ===== Programme " | ||
- | <code c> | ||
- | /* Minimal code for testing bluetooth module TEL0026 with a led. | ||
- | If we received " | ||
- | |||
- | This program must be used with " | ||
- | |||
- | The circuit is based on Dreamer Nano V4.1, compatible Arduino Leonardo ( https:// | ||
- | TEL0026 and button are plugged on Nano I/O Shield ( https:// | ||
- | |||
- | Created 2017 by Simon Lefort. | ||
- | */ | ||
- | |||
- | int ledPin = 14; | ||
- | int incomingByte = 0; | ||
- | |||
- | void setup() { | ||
- | Serial.begin(38400); | ||
- | Serial1.begin(38400); | ||
- | | ||
- | digitalWrite(ledPin, | ||
- | } | ||
- | |||
- | void loop() { | ||
- | if (Serial1.available() > 0){ | ||
- | incomingByte = Serial1.read(); | ||
- | | ||
- | Serial.print(" | ||
- | Serial.println(incomingByte); | ||
- | | ||
- | if (incomingByte = ' | ||
- | digitalWrite(ledPin, | ||
- | delay(500); | ||
- | } | ||
- | } | ||
- | else{ | ||
- | Serial.println(" | ||
- | digitalWrite(ledPin, | ||
- | delay(500); | ||
- | } | ||
- | } | ||
- | </ | ||
- | |||
- | ===== Remarques ===== | ||
- | Ça marche mais c'est basique! Je ne vérifie pas l' |
allumer_une_led_via_bluetooth.1494166704.txt.gz · Dernière modification : 2020/08/09 12:59 (modification externe)