Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef data_h
- #define data_h
- const uint8_t data_error404[] PROGMEM = "<html><head><meta charset='utf-8'></head><body><h1>ERROR 404</h1><p>¯\\_(ツ)_/¯ </p></body></html>"" B";
- else if(bytes < (1024 * 1024)) return String(bytes/1024.0)+" KB";
- else if(bytes < (1024 * 1024 * 1024)) return String(bytes/1024.0/1024.0)+" MB";
- else return String(bytes/1024.0/1024.0/1024.0)+" GB";
- }
- //source: https://forum.arduino.cc/index.php?topic=38107.0
- void PrintHex8(uint8_t *data, uint8_t length){
- Serial.print("0x");
- for (int i=0; i<length; i++) {
- if (data[i]<0x10) {Serial.print("0");}
- Serial.print(data[i],HEX);
- Serial.print(" ");
- }
- }
- //source: http://shelvin.de/eine-integer-zahl-in-das-arduiono-eeprom-schreiben/
- void eepromWriteInt(int adr, int val) {
- byte low, high;
- low = val & 0xFF;
- high = (val >> 8) & 0xFF;
- EEPROM.write(adr, low);
- EEPROM.write(adr+1, high);
- return;
- }
- int eepromReadInt(int adr) {
- byte low, high;
- low = EEPROM.read(adr);
- high = EEPROM.read(adr+1);
- return low + ((high << 8) & 0xFF00);
- }
- #endif
Advertisement
Advertisement