add mac addres read

add struct as commant
This commit is contained in:
user 2024-10-11 21:15:04 +02:00
parent 97dfb13b74
commit 73eaa8982e

View file

@ -1,14 +1,32 @@
#include "esp_log.h"
#include <stdio.h>
#include <time.h>
#include <onewire.h>
#include <ds18b20.h> // Die Header-Datei mit DS18B20-Funktionen
#include <task.h>
#include <esp_wifi.h>
struct appldata;
int app_main() {
// Variable to store the MAC address
uint8_t baseMac[6];
// Get MAC address of the WiFi station interface
esp_read_mac(baseMac, ESP_MAC_WIFI_STA);
printf("Station MAC: ");
for (int i = 0; i < 5; i++) {
printf("%02X:", baseMac[i]);
}
printf("%02X\n", baseMac[5]);
// Create variable for handler
ds18b20_handler_t sensor;
// Check for any initialization failures
if (!ds18b20_init(&sensor, GPIO_NUM_2, TEMP_RES_12_BIT))
{
@ -16,15 +34,7 @@ int app_main() {
return 0; // Exit
}
float temp = 0;
// If you doesn't convert temperature you may read 85.0 Celsius,
// as it is default temperature set by DS18B20 if convert command wasn't issued.
// Read temperature
printf("hit");
for(int i = 0; i < 30; ++i) {
// Initalize conversion
@ -41,5 +51,17 @@ int app_main() {
return 0;
}
/*
struct appldata{
uint8_t uuid;
signed float temp;
unsigned float battaryVoltage;
unsigned long upTime;
}
*/