Skip to content

writeRAM()

Arnd edited this page Aug 8, 2017 · 4 revisions

Function writes any data type to the MCP7940's 64 bytes of SRAM memory. Any writes outside of the valid address space are ignored. The option boolean return value is true when the write was successful otherwise false.


Example:

...
MCP7940_Class MCP7940;        // Create an instance of the MCP7940
...
  char buffer[13] = "Hello there!"; // create and fill a character buffer
  uint8_t singleByte = 123;
  MCP7940.writeRAM(10,buffer); // write it to position 10 in the buffer
  MCP7940.readRAM(10,buffer); // read it back from the MCP7940
  Serial.print("Buffer is \"");
  Serial.print(buffer);
  Serial.println("\".");
  MCP7940.writeRAM(10,singleByte); // write it to position 10 in the buffer
  MCP7940.readRAM(10,SingleByte); // read it back from the MCP7940
  Serial.print("Buffer is \"");
  Serial.print(buffer);
  Serial.println("\".");
...
Clone this wiki locally