Приведение примеров eeprom
This commit is contained in:
1 parent
c9f5563111
commit
52adac2b59
10 files changed
+88
-32
No files matched your search
@@ -12,18 +12,11 @@
|
||||
|
||||
void setup() {
|
||||
// initialize the LED pin as an output.
|
||||
pinMode(13, OUTPUT);
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
EEPROM.begin();
|
||||
|
||||
/***
|
||||
Iterate through each byte of the EEPROM storage.
|
||||
|
||||
Larger AVR processors have larger EEPROM sizes, E.g:
|
||||
- Arduino Duemilanove: 512 B EEPROM storage.
|
||||
- Arduino Uno: 1 kB EEPROM storage.
|
||||
- Arduino Mega: 4 kB EEPROM storage.
|
||||
|
||||
Rather than hard-coding the length, you should use the pre-provided length function.
|
||||
This will make your code portable to all AVR processors.
|
||||
***/
|
||||
|
||||
for (int i = 0 ; i < EEPROM.length() ; i++) {
|
||||
@@ -31,7 +24,7 @@ void setup() {
|
||||
}
|
||||
|
||||
// turn the LED on when we're done
|
||||
digitalWrite(13, HIGH);
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
/***
|
||||
Written by Christopher Andrews.
|
||||
CRC algorithm generated by pycrc, MIT licence ( https://github.com/tpircher/pycrc ).
|
||||
CRC algorithm generated by pycrc ( https://github.com/tpircher/pycrc ).
|
||||
|
||||
A CRC is a simple way of checking whether data has changed or become corrupted.
|
||||
This example calculates a CRC value directly on the EEPROM values.
|
||||
The purpose of this example is to highlight how the EEPROM object can be used just like an array.
|
||||
***/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <EEPROM.h>
|
||||
|
||||
void setup() {
|
||||
|
||||
//Start serial
|
||||
Serial.begin(9600);
|
||||
EEPROM.begin();
|
||||
while (!Serial) {
|
||||
; // wait for serial port to connect. Needed for native USB port only
|
||||
}
|
||||
|
||||
@@ -10,14 +10,12 @@
|
||||
This may cause the serial object to print out a large string
|
||||
of garbage if there is no null character inside one of the strings
|
||||
loaded.
|
||||
|
||||
Written by Christopher Andrews 2015
|
||||
Released under MIT licence.
|
||||
***/
|
||||
|
||||
#include <EEPROM.h>
|
||||
|
||||
void setup() {
|
||||
EEPROM.begin();
|
||||
|
||||
float f = 0.00f; //Variable to store data read from EEPROM.
|
||||
int eeAddress = 0; //EEPROM address to start reading from
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <EEPROM.h>
|
||||
|
||||
void setup() {
|
||||
EEPROM.begin();
|
||||
|
||||
/***
|
||||
Iterate the EEPROM using a for loop.
|
||||
|
||||
@@ -23,6 +23,7 @@ struct MyObject {
|
||||
};
|
||||
|
||||
void setup() {
|
||||
EEPROM.begin();
|
||||
|
||||
Serial.begin(9600);
|
||||
while (!Serial) {
|
||||
|
||||
@@ -13,6 +13,7 @@ int address = 0;
|
||||
byte value;
|
||||
|
||||
void setup() {
|
||||
EEPROM.begin();
|
||||
// initialize serial and wait for port to open:
|
||||
Serial.begin(9600);
|
||||
while (!Serial) {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
int address = 0;
|
||||
|
||||
void setup() {
|
||||
/** Empty setup **/
|
||||
EEPROM.begin();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
int addr = 0;
|
||||
|
||||
void setup() {
|
||||
/** Empty setup. **/
|
||||
EEPROM.begin();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
Reference in new issue
Block a user