Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: I2C eprom help

  1. #1

    I2C eprom help

    hi, I use a teensy 3.2 with an eprom i2c M24256, but I can't write an integer, I get up to the byte (256). is there any library that lets me write and read an integer? did anyone do that? can you send me a working piece of code?
    thank you all.

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,565
    Just write the integer as four bytes?
    pseudocode:
    Code:
    write(myInteger & 0xff);
    write((myInteger >> 8) & 0xff);
    write((myInteger >> 16) & 0xff);
    write((myInteger >> 24) & 0xff);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •