add mac addres read
add struct as commant
This commit is contained in:
parent
97dfb13b74
commit
73eaa8982e
1 changed files with 31 additions and 9 deletions
|
@ -1,14 +1,32 @@
|
||||||
|
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <onewire.h>
|
#include <onewire.h>
|
||||||
#include <ds18b20.h> // Die Header-Datei mit DS18B20-Funktionen
|
#include <ds18b20.h> // Die Header-Datei mit DS18B20-Funktionen
|
||||||
#include <task.h>
|
#include <task.h>
|
||||||
|
#include <esp_wifi.h>
|
||||||
|
|
||||||
|
struct appldata;
|
||||||
|
|
||||||
int app_main() {
|
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
|
// Create variable for handler
|
||||||
ds18b20_handler_t sensor;
|
ds18b20_handler_t sensor;
|
||||||
|
|
||||||
// Check for any initialization failures
|
// Check for any initialization failures
|
||||||
if (!ds18b20_init(&sensor, GPIO_NUM_2, TEMP_RES_12_BIT))
|
if (!ds18b20_init(&sensor, GPIO_NUM_2, TEMP_RES_12_BIT))
|
||||||
{
|
{
|
||||||
|
@ -16,15 +34,7 @@ int app_main() {
|
||||||
|
|
||||||
return 0; // Exit
|
return 0; // Exit
|
||||||
}
|
}
|
||||||
|
|
||||||
float temp = 0;
|
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");
|
printf("hit");
|
||||||
for(int i = 0; i < 30; ++i) {
|
for(int i = 0; i < 30; ++i) {
|
||||||
// Initalize conversion
|
// Initalize conversion
|
||||||
|
@ -41,5 +51,17 @@ int app_main() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
struct appldata{
|
||||||
|
uint8_t uuid;
|
||||||
|
signed float temp;
|
||||||
|
unsigned float battaryVoltage;
|
||||||
|
unsigned long upTime;
|
||||||
|
}
|
||||||
|
*/
|
Loading…
Reference in a new issue