Обновление до версии 0.3.0
- обновлен elbear_fw_bootloader - добавлена проверка контрольной суммы каждой строки hex файла. - в модуль работы с АЦП добавлена функция analogReadResolution(). Функция analogRead() теперь возвращает усредненное по 10 измерениям значение. - общая функция обработки прерываний перенесена в память RAM. Обработчики прерываний модулей External Interrupts и Advanced I/O (функция tone()) так же перенесены в память RAM для увеличения скорости выполнения кода. - в пакет добавлены библиотеки EEPROM, Servo, SoftSerial, NeoPixel, MFRC522 адаптированные для работы с платой Elbear Ace-Uno. - добавлено описание особенностей работы с пакетом
This commit is contained in:
1 parent
2044614aba
commit
7261b03ea1
114 files changed
+11064
-666
No files matched your search
@@ -0,0 +1,56 @@
|
||||
/***
|
||||
eeprom_put example.
|
||||
|
||||
This shows how to use the EEPROM.put() method.
|
||||
Also, this sketch will pre-set the EEPROM data for the
|
||||
example sketch eeprom_get.
|
||||
|
||||
Note, unlike the single byte version EEPROM.write(),
|
||||
the put method will use update semantics. As in a byte
|
||||
will only be written to the EEPROM if the data is actually
|
||||
different.
|
||||
***/
|
||||
|
||||
#include <EEPROM.h>
|
||||
|
||||
struct MyObject {
|
||||
float field1;
|
||||
byte field2;
|
||||
char name[10];
|
||||
};
|
||||
|
||||
void setup() {
|
||||
EEPROM.begin();
|
||||
|
||||
Serial.begin(9600);
|
||||
while (!Serial) {
|
||||
; // wait for serial port to connect. Needed for native USB port only
|
||||
}
|
||||
|
||||
float f = 123.456f; //Variable to store in EEPROM.
|
||||
int eeAddress = 0; //Location we want the data to be put.
|
||||
|
||||
|
||||
//One simple call, with the address first and the object second.
|
||||
EEPROM.put(eeAddress, f);
|
||||
|
||||
Serial.println("Written float data type!");
|
||||
|
||||
/** Put is designed for use with custom structures also. **/
|
||||
|
||||
//Data to store.
|
||||
MyObject customVar = {
|
||||
3.14f,
|
||||
65,
|
||||
"Working!"
|
||||
};
|
||||
|
||||
eeAddress += sizeof(float); //Move address to the next byte after float 'f'.
|
||||
|
||||
EEPROM.put(eeAddress, customVar);
|
||||
Serial.print("Written custom data type! \n\nView the example sketch eeprom_get to see how you can retrieve the values!");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
/* Empty loop */
|
||||
}
|
||||
Reference in new issue
Block a user