Lưu các giá trị double, float, int… vào bộ nhớ EEPROM của arduino

Chapichuse

Đam mê công nghệ

You may also like...

2 Responses

  1. Reed Noel viết:

    mình theo hướng dẫn bị lỗi, nhờ giúp đỡ:
    ‘struct EEPROMClass’ has no member named ‘WriteInt’

  2. Chapichuse viết:

    Bạn thử làm theo các bước sau:
    1. Download thu viện về: https://github.com/thijse/Arduino-EEPROMEx/archive/master.zip
    2. Vào Aruino menu > Sketch > Include library > Add .Zip library, Chọn file Zip vừa tải về
    3. Chạy thử đoạn code sau:

    #include // Chỉ cần Include file này

    int address = 0; //địa chỉ cần ghi vào
    double input = 100.12; //Giá trị cần ghi vào EEprom
    double output = 0;// Giá trị cần đọc ra từ EEprom

    void setup()
    {
    Serial.begin(9600);
    EEPROM.writeDouble(address, input);
    output = EEPROM.readDouble(address);
    Serial.print(address);
    Serial.print("\t");
    Serial.print(output);
    Serial.println();
    }

    void loop()
    {
    }

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *