Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void saveDS18B20() {
- File saveFile = SPIFFS.open(DS18B20_FILE, "w");
- //historyFile.print(writeAddress(sensor1).c_str());
- uint8_t sensor4[8] = { 0x28, 0x9d, 0x5f, 0x9b, 0x5b, 0x14, 0x01, 0x59 };
- saveFile.write((const uint8_t *)sensor4, sizeof(sensor4));
- saveFile.close();
- }
- void loadDS18B20() {
- File file = SPIFFS.open(DS18B20_FILE, "r");
- if (!file) {
- Serial.println("No ds18b20-1 Exist");
- } else {
- size_t size = file.size();
- if ( size == 0 ) {
- Serial.println("History file empty !");
- } else {
- Serial.println("History file loaded !");
- Serial.println(size);
- uint8_t message[8]= {'\0'};
- String str = file.readString();
- const char *pStr = str.c_str();
- Serial.println(pStr);
- memcpy(message, pStr, 8);
- printAddress(message);
- float tempC = sensors.getTempC(message);
- Serial.print("temperature1: ");
- Serial.println(tempC);
- Serial.println(CheckAddress(message));
- }
- file.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement