It's more or less no differerent than the code that Adafruit provides.Ĭode: #include #include #include Adafruit_LIS3MDL lis3mdl #define LIS3MDL_CLK 13 #define LIS3MDL_MISO 12 #define LIS3MDL_MOSI 11 #define LIS3MDL_CS 10 // Set up Function void setup(void) If it helps, below is code that I'm using to diagnose coding with the sensor, though this isn't my final code. Why am I getting less data than expected? Regarding the timestamp, I'm using Arduino's millis() function to get a time stamp of sorts (based on how many milliseconds have elapsed since the program has started), but what is this function based on? Is it tied to the Arduino processor, or is it tied to something else? Could the LIS3MDL have some sort of time feature that is screwing up my time stamp? But that shouldn't be possible since my time stamp doesn't involve reading from the sensor. Likewise, setting it to lower frequencies results in the same behavior. By my calculations, assuming a data point every cycle, I should get ~11000 data points after 11 seconds. For instance, when running my code, after 11 seconds, I only get 6461 data points, and that is when I set the LIS3MDL data rate to 1 kHz. However, changing the data rate doesn't seem to correspond with an increase in data points. According to Adafruit's tutorial, you can set the LIS3MDL's data rate from 0.625 Hz to 1 kHz. The problems that I'm facing have to do with the data rate and the timestamp. I'm reading data, so there's nothing wrong with the wiring. This is all through the Arduino software, and I'm using a QWIIC converter cable to connect from the Portenta to the sensor through I2C. I'm using the Arduino Portenta to read from a sensor, the LIS3MDLmagnetometer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |