這是我寫的對Arduino單片機Eeprom進行讀寫的源程序,
可以為Arduino內存不夠提供一種可行的解決方案,
希望能給大家一些幫助。
Arduino源程序如下:
- #include <EEPROM.h>
- int address = 0;
- byte value;
- void setup()
- {
- // put your setup code here, to run once:
- Serial.begin(9600);
- }
- void loop()
- {
- // put your main code here, to run repeatedly:
-
- for(int i=0;i<512;i++)
- {
- EEPROM.write(address,i);address++;
- }
- address=0 ;
- for(int i=0;i<512;i++)
- {
- value=EEPROM.read(address);
- Serial.print(address);
- Serial.print("\t");
- Serial.print(value, DEC);
- Serial.println();
- delay(100);address++;
- }
-
- for (int i = 0; i < 512; i++)
- EEPROM.write(i, 0);
- address=0 ;
- for(int i=0;i<512;i++)
- {
- value=EEPROM.read(address);
- Serial.print(address);
- Serial.print("\t");
- Serial.print(value, DEC);
- Serial.println();
- delay(1000);address++;
- }
- address=0 ;
- }
復制代碼
所有資料51hei提供下載:
EEPROMxieduchu.zip
(624 Bytes, 下載次數(shù): 15)
2018-2-15 10:14 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
|