plottin' and datasheetin'

This commit is contained in:
ladyada 2019-07-21 17:39:26 -04:00
parent 7da03c0c6a
commit d689757b04
2 changed files with 37 additions and 0 deletions

BIN
MSA301-V1.0-ENG.PDF Normal file

Binary file not shown.

View file

@ -0,0 +1,37 @@
// Basic demo for plotting accelerometer readings from Adafruit MSA301
#include <Wire.h>
#include <Adafruit_MSA301.h>
#include <Adafruit_Sensor.h>
Adafruit_MSA301 msa;
void setup(void) {
Serial.begin(115200);
while (!Serial) delay(10); // will pause Zero, Leonardo, etc until serial console opens
Serial.println("Adafruit MSA301 test!");
// Try to initialize!
if (! msa.begin()) {
Serial.println("Failed to find MSA301 chip");
while (1) { delay(10); }
}
Serial.println("MSA301 Found!");
}
void loop() {
/* Get a new sensor event, normalized */
sensors_event_t event;
msa.getEvent(&event);
/* Display the results (acceleration is measured in m/s^2), with commas in between */
Serial.print(event.acceleration.x);
Serial.print(", "); Serial.print(event.acceleration.y);
Serial.print(", "); Serial.print(event.acceleration.z);
Serial.println();
delay(10);
}