PIR_MadMax/Sécurité/Application/Application.ino
2026-03-31 16:26:58 +02:00

88 lines
1.9 KiB
C++

/*
#include <SoftwareSerial.h>
//Adress of HC-05: 98:D3:51:FF:08:5E
sudo rfcomm release 0
sudo rfcomm connect 0 98:D3:51:FF:08:5E 1
echo "H" | sudo tee /dev/rfcomm0
sudo screen /dev/rfcomm0 9600
Rien qui marche, un vrai problème. Linux arrive à parler avec la module, ou je me connecte bien avec le module.
Mais dès que j'essaye de retrouver le message ou string envoyé par l'environnement Linux, rien s'affiche dans le serial monitor
Faut rechercher plus, jsp. Parler avec Acco peut-etre. Faut que je regarde auusi sur un oscillo pour juste voir si quelque bits arrive ou quoi
*/
/*
#define RX 14 //D5
#define TX 12 //D6
SoftwareSerial mySer(RX,TX);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
while(!Serial){};
Serial.println("Testing here!");
mySer.begin(9600);
mySer.println("Testing 2!");
}
void loop() {
//Serial.println("H");
delay(2000);
//Reponse sur l'oscillo:
//111111111000 01001010 101001 10100011 011010001101101011111011010101100001001010000 11111111111111
// 000 010010101 010011
// Message envoyé: Hello = 01001000 01100101 01101100 01101100 01101111 00100000
//Bare "H": 01001000
// h MED LSB til venstre: 00010010
// Envoyé: 0 _00010010_ 10101100001001010000 /Hva nå enn dette er, ingen peiling...
if(mySer.available()){
Serial.write(mySer.read());
}
if(Serial.available()){
mySer.write(Serial.read());
}
}
*/
// ça marche avec Serial Bluetooth Terminal
#include <SoftwareSerial.h>
#define RXBT 14 // D5
#define TXBT 12 // D6
SoftwareSerial mySer(RXBT, TXBT);
void setup() {
Serial.begin(9600); // Serial Monitor
mySer.begin(9600); // HC-05
Serial.println("ESP8266 ready!");
}
void loop() {
// Bluetooth → Serial Monitor
while (mySer.available()) {
char c = mySer.read();
Serial.print(c);
}
// Serial Monitor → Bluetooth
while (Serial.available()) {
char c = Serial.read();
mySer.print(c);
}
}