-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/pu2clr/QN8066
- Loading branch information
Showing
21 changed files
with
101 additions
and
2,458 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file removed
BIN
-687 KB
..._UNDER_CONSTRUCTION/04_ESP32_WEB_ACTIVE_PORTAL_QN8066/ESP32_ACCESS_POINT_01.PNG
Binary file not shown.
Binary file removed
BIN
-203 KB
..._UNDER_CONSTRUCTION/04_ESP32_WEB_ACTIVE_PORTAL_QN8066/ESP32_ACCESS_POINT_02.PNG
Binary file not shown.
Binary file removed
BIN
-638 KB
..._UNDER_CONSTRUCTION/04_ESP32_WEB_ACTIVE_PORTAL_QN8066/ESP32_ACCESS_POINT_03.PNG
Binary file not shown.
Binary file removed
BIN
-407 KB
..._UNDER_CONSTRUCTION/04_ESP32_WEB_ACTIVE_PORTAL_QN8066/ESP32_ACCESS_POINT_04.jpg
Binary file not shown.
Binary file removed
BIN
-474 KB
..._UNDER_CONSTRUCTION/04_ESP32_WEB_ACTIVE_PORTAL_QN8066/ESP32_ACCESS_POINT_05.jpg
Binary file not shown.
544 changes: 0 additions & 544 deletions
544
..._ESP32_WEB_ACTIVE_PORTAL_QN8066/ESP32_ACTIVE_PORTAL_QN8066/ESP32_ACTIVE_PORTAL_QN8066.ino
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
examples/99_UNDER_CONSTRUCTION/04_ESP32_WEB_ACTIVE_PORTAL_QN8066/README.md
This file was deleted.
Oops, something went wrong.
48 changes: 0 additions & 48 deletions
48
examples/99_UNDER_CONSTRUCTION/06_TX_ATTINY2/06_TX_ATTINY2/06_TX_ATTINY2.ino
This file was deleted.
Oops, something went wrong.
66 changes: 0 additions & 66 deletions
66
..._CONSTRUCTION/0X_ESP32_BLUETOOTH_QN8066/ESP32_BLUETOTTH_QN8066/ESP32_BLUETOTTH_QN8066.ino
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
examples/99_UNDER_CONSTRUCTION/ATMEGA328_BLUETOOTH_HC_05/PYTHON_CLIENT/client.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import asyncio | ||
from bleak import BleakClient | ||
|
||
# Endereço MAC do módulo HC-05 | ||
ADDRESS = "00:00:00:00:00:00" # Substitua pelo endereço correto | ||
|
||
# UUID do serviço Bluetooth (pode variar, ajustar se necessário) | ||
CHARACTERISTIC_UUID = "00001101-0000-1000-8000-00805F9B34FB" | ||
|
||
async def send_data(first_name, last_name, social_number): | ||
async with BleakClient(ADDRESS) as client: | ||
if client.is_connected: | ||
print(f"Conectado ao dispositivo {ADDRESS}") | ||
data = f'{{"firstName": "{first_name}", "lastName": "{last_name}", "socialNumber": "{social_number}"}}\n' | ||
await client.write_gatt_char(CHARACTERISTIC_UUID, data.encode()) | ||
print("Dados enviados:", data) | ||
|
||
async def get_data(): | ||
async with BleakClient(ADDRESS) as client: | ||
if client.is_connected: | ||
await client.write_gatt_char(CHARACTERISTIC_UUID, "GET_DATA\n".encode()) | ||
response = await client.read_gatt_char(CHARACTERISTIC_UUID) | ||
print("Dados recebidos:", response.decode('utf-8')) | ||
|
||
# Exemplo de execução | ||
async def main(): | ||
await send_data("John", "Doe", "123-45-6789") | ||
await asyncio.sleep(2) | ||
await get_data() | ||
|
||
asyncio.run(main()) |
60 changes: 60 additions & 0 deletions
60
.../99_UNDER_CONSTRUCTION/ATMEGA328_BLUETOOTH_HC_05/SKETCH/atmega328_hc05/atmega328_hc05.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include <EEPROM.h> | ||
#include <ArduinoJson.h> // Instale a biblioteca ArduinoJson (https://arduinojson.org/) | ||
|
||
const int EEPROM_SIZE = 96; | ||
|
||
struct UserData { | ||
char firstName[30]; | ||
char lastName[30]; | ||
char socialNumber[30]; | ||
}; | ||
|
||
// Função para gravar dados na EEPROM | ||
void saveToEEPROM(UserData &data) { | ||
EEPROM.put(0, data); | ||
} | ||
|
||
// Função para ler dados da EEPROM | ||
UserData readFromEEPROM() { | ||
UserData data; | ||
EEPROM.get(0, data); | ||
return data; | ||
} | ||
|
||
void setup() { | ||
Serial.begin(9600); // Comunicação Bluetooth | ||
EEPROM.begin(); // Inicializa EEPROM | ||
|
||
Serial.println("Arduino pronto para receber dados via Bluetooth..."); | ||
} | ||
|
||
void loop() { | ||
if (Serial.available()) { | ||
String json = Serial.readStringUntil('\n'); // Recebe o JSON | ||
JsonDocument doc; | ||
DeserializationError error = deserializeJson(doc, json); | ||
|
||
if (!error) { | ||
UserData data; | ||
strlcpy(data.firstName, doc["firstName"] | "", sizeof(data.firstName)); | ||
strlcpy(data.lastName, doc["lastName"] | "", sizeof(data.lastName)); | ||
strlcpy(data.socialNumber, doc["socialNumber"] | "", sizeof(data.socialNumber)); | ||
|
||
saveToEEPROM(data); // Grava na EEPROM | ||
Serial.println("Dados armazenados com sucesso!"); | ||
} else { | ||
// Solicitação para enviar os dados salvos | ||
if (json == "GET_DATA") { | ||
UserData data = readFromEEPROM(); | ||
JsonDocument response; | ||
response["firstName"] = data.firstName; | ||
response["lastName"] = data.lastName; | ||
response["socialNumber"] = data.socialNumber; | ||
|
||
String responseData; | ||
serializeJson(response, responseData); | ||
Serial.println(responseData); // Envia resposta via Bluetooth | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.