Driver for MMA8451 accelerometer (AdaFruit)

Dear Sirs,
I am new to Zerynth (and I2C), and am working on getting the AdaFruit MMA8451 accelerometer working on the Sparkfun ESP32 Thing.
I am trying to leverage the AdaFruit CircuitPython library already written. I have two questions:

  1. I had the accelerometer working in about an hour using the Arduino IDE and default pins. Is it really the case that I have to change pins to use I2C under Zerynth?
  2. The Zerynth documentation surrounding I2C is very sparse, and the examples given are fairly complicated. Is there an simple example I can start from?

This is disappointing. I like the idea of programming in Python in Zerynth, but the restrictions and limitations of the IDE (I have to clone a repository to even look at examples?, and even then, not all files are pulled into the project folder?)

Sincerely,
Duane

Hi @duanekaufman
Yes, you can use the adafruit library, port it to zerynth then use it in zerynth studio.
perhaps you can look at some libraries developed in I2C to see of examples of using I2C in zerynth.
BME280 sensor, destination :
~/.zerynth2/dist/r2.6.0/libs/official/bosch/bme280
MAX30101;
~/.zerynth2/dist/r2.6.0/libs/official/maxim/max30101

Have a look and let me know if you have questions.
cheers

Dear Sir,
Yes, I have looked at the examples, but they are not simple, nor are they easy to obtain (is there a way to download all examples locally, so I don’t have to go to github every time I want to look at one?)

I would like a simple, one-file example, without classes. I know I am not owed one…

Is there any way to change the pins used for I2C? The pins Zerynth uses are different from the ones that are default for the Arduino IDE, and I have mine soldered down on my Sparkfun ESP32 Thing.

Thanks,
Duane

Why do you go to github? These libraries are in your installation folder.
each of them is one python file, please navigate to them in your machine in your installation directory and let me know if you need more help in this point.
2- I2C pins usually are related to the hardware peripherals, so please check the pinmap of your device inside zerynth studio.
When you connect the device, click on ’ Device pinmap’
You’ll find pins of each peripheral in the device in the peripheral view

Note, you can also clone any example to test it without leaving zerynth studio, have a look at this guide.
https://docs.zerynth.com/latest/develop/#start-with-an-example
more tutorials on our blog: https://www.zerynth.com/blog/

Dear Sir,
Thanks for replying.
I am working under Windows, and I cannot find all of the files for an example (if I clone an example, I get the example file, but not the driver file, since I am porting, I would like to see driver files)
I understand how to look up the Zerynth definition for the i2c pins, but Zerynth defines these differently than the Arduino IDE, and I wish to switch back and forth, hence the question about changing the i2c pins under Zerynth.

Sincerely,
Duane

as for the libraries, check where you installed zerynth studio, for default, check C:\Users(username)\zerynth2. (check for hidden folders)
when you clone the example you get the application files, the needed libraries are at the libraries folder inside .zerynth2 folder.
if you want to use your own library you can add it inside your zerynth project folder.

let me know if you have more questions.
cheers

Dear Sir,
You are correct, I was able to find the examples (and driver files).

Is there a way to change the i2c pin assignments in Zerynth to match those in the Arduino IDE?

Sincerely,
Duane