Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
I2C Axis Accelerometer
Für den MMA7660 ist die Bibliothek über Tool->Manage Libraries (Strg+Shift+I) Accelerometer_MMA7660 zu installieren. Eine Beschreibung ist auch im Arduino Playground zu finden. Über Files->Examples->Accelerometer_MMA7660->MMA7660FC_Demo.ino kann das Demo-Programm geladen, compiliert und auf den ESP32 geladen werden oder das folgende Programm verwendet werden:
#include <Wire.h> #include "MMA7660.h" MMA7660 accelemeter; void setup() { accelemeter.init(); Serial.begin(9600); } void loop() { int8_t x, y, z; float ax,ay,az; enum {BufSize=50}; char buf [BufSize]; float myFloat = -1.012; Serial.println("******************************************"); accelemeter.getXYZ(&x,&y,&z); snprintf (buf, BufSize, "x=%d y=%d z=%d", x, y, z); // snprintf is safer than sprintf Serial.println(buf); accelemeter.getAcceleration(&ax,&ay,&az); snprintf (buf, BufSize, "ax: %.2fg ay: %.2fg az: %.2fg", ax, ay, az); Serial.println(buf); delay(500); }