Arduino EEPROM 的操作
#include <EEPROM.h>
struct MyObject{
float field1;
byte field2;
char name[10];
};
void setup(){
Serial.begin(9600);
while (!Serial) {
;
}
float f = 123.456f;
unsigned int eeAddress = 0;
EEPROM.write( eeAddress, f );
Serial.println("Written float data type!");
MyObject customVar = {
3.14f,
65,
"Working"
};
eeAddress += sizeof(float);
//EEPROM.write( eeAddress, customVar );
EEPROM_write_block ((unsigned char*)&customVar,eeAddress,sizeof(MyObject));
Serial.print( "Written custom data type! \n\nView the example sketch eeprom_get to see how you can retrieve the values!" );
MyObject xixi ;
EEPROM_read_block((unsigned char*)&xixi,eeAddress,sizeof(MyObject));
Serial.print(xixi.field1);
Serial.print(xixi.field2);
Serial.print(xixi.name);
}
void loop(){
//int address = 0;
//float f ;
// EEPROM.read(address,f);
// address += sizeof(MyObject);
}
void EEPROM_write_block(unsigned char *memory_block, unsigned int start_address, unsigned int block_size)
{
unsigned char Count = 0;
for (Count=0; Count < block_size; Count++)
{
EEPROM.write(start_address + Count, memory_block[Count]);
}
}
void EEPROM_read_block(unsigned char *memory_block, unsigned int start_address, unsigned int block_size)
{
unsigned char Count = 0;
for (Count=0; Count < block_size; Count++)
{
memory_block[Count]= EEPROM.read(start_address + Count);
}
}
相關文章
- arduino操作遙感UI
- EVASH Ultra EEPROM
- 關於STC微控制器的內部EEPROM操作問題日常分享
- (11.1)iic串列埠讀寫EEPROM實驗:EEPROM介紹串列埠
- Arduino IDE框架 Arduino UnoUIIDE框架
- Camera EEPROM bringup
- Arduino Yun的硬體——Arduino Yun快速入門教程UI
- Arduino 入門之Arduino介紹UI
- Arduino BuildingUI
- Arduino初學UI
- Arduino 學習UI
- Arduino Yun的主要部件介紹選自Arduino Yun快速入門教程UI
- 非易失性儲存器EEPROM
- AVR微控制器EEPROM學習VR
- EVASH Ultra EEPROM Development Board User GuidedevGUIIDE
- Arduino 封裝庫UI封裝
- esp8266使用ARDUINO關於SSD1306操作問題UI
- Arduino可穿戴教程Linux平臺下安裝Arduino IDEUILinuxIDE
- arduino韌體燒錄UI
- Arduino可穿戴開發入門教程Arduino開發環境介紹UI開發環境
- STM32L0系列EEPROM中結構體的讀取結構體
- Arduino學習筆記13UI筆記
- Arduino 上手實戰呼吸燈UI
- nodemcu arduino設定按鍵UI
- Arduino IDE Mac安裝UIIDEMac
- Arduino IDE 環境配置UIIDE
- Arduino調整小車速度UI
- Arduino開發環境配置UI開發環境
- EEPROM與記憶體Flash消耗能量計算記憶體
- STM32 IIC讀取Eeprom失敗問題
- 宏旺半導體分析EEPROM和FLASH的區別及各自的優缺點
- Arduino下的STM32的串列埠通訊UI串列埠
- Arduino可穿戴開發入門教程Windows平臺下安裝Arduino IDEUIWindowsIDE
- Arduino 壓電陶瓷 架子鼓UI
- 揭祕《Arduino技術內幕》UI
- 誠徵譯者《Arduino Wearable Projects》UIProject
- 嵌入式 Arduino 期末複習UI
- Arduino&pn532破解加密卡UI加密