So, I've connected an ADXL345 via i2c using 2 N-channel MOSFETs to perform 5v <-> 3.3v level shifting. Unfortunately, this is my first experience with i2c, and it doesn't seem to be working all that well. I adapted the library here:
https://github.com/jenschr/Arduino-libraries/tree/master/ADXL345 to use TinyWireM and built a program to just read the values and output them via DigiUSB. Source for the code here:
http://pastebin.com/8j4DD4GN Unfortunately, the program hangs without giving any output on DigiUSB. DigiUSB is working, because I can comment out lines 20-30 and get "foo", "foo", "foo", etc.
My mosfet setup is pretty simple, just exactly what the application note here suggests:
http://ics.nxp.com/support/documents/interface/pdf/an97055.pdf I've got 4.7k pullups on both sides on both SDA and SCL, BS170 mosfets in the middle. My 3v3 rail looks good, but there doesn't seem to be much else I can tell with just a multimeter.
Any suggestions? I don't think it's the Digispark itself, but hoping someone has ideas...