eeprom-write-uint

gst/ee-prom-read-write-uint16bit/eeprom-write-uint

No description
eeprom-write-uint
@/eeprom-write-uint
ADDRnumber
Address in EEPROM where the value should be stored
VALnumber
unsignd integer value to be stored
UPDpulse
Trigger the write function
eeprom-write-uint
ADDR
VAL
UPD
OK
OKpulse
Emitted after calling EEPROM.write
To use the node in your project you should have the gst/ee-prom-read-write-uint16bit library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD require "https://github.com/dancojocaru2000/ArduinoEEPROM"

{{#global}}
#include <EEPROM.h>
{{/global}}

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    if (isInputDirty<input_UPD>(ctx)) {
        auto addr = getValue<input_ADDR>(ctx);
        auto val = getValue<input_VAL>(ctx);

       uint16_t addresse = addr;
        
       uint16_t wert = val; 
    byte lowbyte = 0;
    byte highbyte = 0;    
    word hlbyte = 0;
    hlbyte =  word(wert);
     
                
    lowbyte =(( hlbyte) & 0x00FF);
    highbyte =((hlbyte >> 8) & 0xFF);  
        
    EEPROM.write(addresse,lowbyte);  
       
    addresse = addresse + 1;
        
    EEPROM.write(addresse,highbyte);
                       
            
        emitValue<output_OK>(ctx, true);
    }
}

/*This function will write a 2 byte integer to the eeprom at the specified address and address + 1
   
*/