cyberp / at24cx Goto Github PK
View Code? Open in Web Editor NEWLibrary for using the Atmels EEPROM AT24C32/AT24C64/AT24C128/AT24C256/AT24C512 in Arduino projects.
License: MIT License
Library for using the Atmels EEPROM AT24C32/AT24C64/AT24C128/AT24C256/AT24C512 in Arduino projects.
License: MIT License
Is not possible to change te I2C adress, only changing in the file AT24CX.h like shown below.
// AT24Cx I2C adress
// 80
// 0x57
#define AT24CX_ID B1010111
On function AT24CX::write
https://github.com/cyberp/AT24Cx/blob/master/AT24CX.cpp#L121
https://github.com/cyberp/AT24Cx/blob/master/AT24CX.cpp#L233
there are delay(20). This okay if you only perform some write. But if you want to perform to reset the chip (erase entire address) with big capacity, it'll take long time. Delay 1 ms should enough and it's works.
Can any guide available how to use this library with Struct in Arduino ?
I have custom struct with more than 10 fields. i need to store data using this library
I've seen this issue a few times where wire.begin is called before setup starts (IE global scoped variable), and it seems to hang on most recent Arduino builds.
Any easy fix is to defer the Wire.begin call until the first write or read attempt is made.
I'll submit a PR from my fork should you wish to accept. I've tested it on a SAMD32 board.
The info page says "uses the device with index 0 and given page size. You can select a device with given index between 0 and 8 with constructor" but I believe this should read "between 0 and 7" as there are only 8 possible addresses, not 9.
#include <AT24CX.h>
AT24C32 EepromRTC(0x57);
void setup()
{
EepromRTC.writeFloat(2,4.56);
EepromRTC.writeInt(8, 0);
EepromRTC.writeLong(13, 560);
EepromRTC.writeFloat(19, 5.56);
EepromRTC.writeFloat(25, 7.57);
EepromRTC.writeFloat(31, 7.87);
EepromRTC.writeFloat(37, 5.76);
EepromRTC.writeFloat(43, 9.88);
EepromRTC.writeInt(50, 999);
consigna_caudal = EepromRTC.readFloat(2);
AlarmDetectCount = EepromRTC.readInt(8);
totalizadorKm3 = EepromRTC.readLong(13);
M_nivel_v_CM = EepromRTC.readFloat(19);
B_nivel_v_CM = EepromRTC.readFloat(25);
L_metros = EepromRTC.readFloat(31);
Sf = EepromRTC.readFloat(37);
n_ru = EepromRTC.readFloat(43);
isVirtualManEn = EepromRTC.readInt(50);
SerialMon.print(" consigna_caudal ");
SerialMon.println(consigna_caudal );
SerialMon.print(" totalizadorKm3 ");
SerialMon.println(totalizadorKm3 );
SerialMon.print(" AlarmDetectCount ");
SerialMon.println(AlarmDetectCount );
SerialMon.print(" M_nivel_v_CM ");
SerialMon.println(M_nivel_v_CM );
SerialMon.print(" B_nivel_v_CM ");
SerialMon.println(B_nivel_v_CM );
SerialMon.print(" L_metros ");
SerialMon.println(L_metros );
SerialMon.print(" Sf ");
SerialMon.println(Sf );
SerialMon.print(" n_ru ");
SerialMon.println(n_ru );
SerialMon.print(" isVirtualManEn ");
SerialMon.println(isVirtualManEn);
RESULT:
9:31:05.938 -> consigna_caudal 4.56
19:31:05.938 -> totalizadorKm3 560
19:31:05.938 -> AlarmDetectCount 1083244544
19:31:05.938 -> M_nivel_v_CM 5.56
19:31:05.938 -> B_nivel_v_CM 7.57
19:31:05.938 -> L_metros 7.87
19:31:05.938 -> Sf 5.76
19:31:05.938 -> n_ru 9.88
19:31:05.938 -> isVirtualManEn 1092486119
For me float, long work well, but with int i have this problem. in workin in ESP32
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.