I am making a two stage rocket with 2 F motors, and I think that I will be able to measure both velocity, altitude, temperature and pressure. with the BMP280 arduino module. I will upload this to an SD card, and retrieve it after the rocket lands. From what I understand you can measure approximate altitude with this module, so if I take the time between each of the readings, I will be able to do some math, and find the approximate velocity. I do not know how to do this, and I ran into this error code while working on the code.
Arduino: 1.8.13 (Mac OS X), Board: "Arduino Uno"
In file included from /Users/nbagley/Documents/Arduino/Rocket_code/Rocket_code.ino:3:0:
/Users/nbagley/Documents/Arduino/libraries/adafruit-Adafruit_BMP280_Library-2d94a81/Adafruit_BMP280.h:24:10: fatal error: Adafruit_Sensor.h: No such file or directory
#include "Adafruit_Sensor.h"
^~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Arduino Uno.
I am rather confused by this error code, but here is my full code below:
#include <SPI.h>
#include <SD.h>
#include <Adafruit_BMP280.h>
Adafruit_BMP280 bmp; // I2C Interface
File myFile;
File pressureFile;
File altitudeFile;
File velocityFile;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
Serial.print("Initializing SD card...");
if (!SD.begin(10)) {
Serial.println("initialization failed!");
while (1);
bmp.setSampling(Adafruit_BMP280::MODE_NORMAL, /* Operating Mode. */
Adafruit_BMP280::SAMPLING_X2, /* Temp. oversampling */
Adafruit_BMP280::SAMPLING_X16, /* Pressure oversampling */
Adafruit_BMP280::FILTER_X16, /* Filtering. */
Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */
}
Serial.println("initialization done.");
myFile = SD.open("tempValue.txt", FILE_WRITE);
// if the file opened okay, write to it:
if (myFile) {
myFile.println("The Data is Shown Below:)");
}
pressureFile = SD.open("pressureValue.txt", FILE_WRITE);
// if the file opened okay, write to it:
if (pressureFile) {
pressureFile.println("The Data is Shown Below:)");
}
altitudeFile = SD.open("altitudeValue.txt", FILE_WRITE);
// if the file opened okay, write to it:
if (altitudeFile) {
altitudeaFile.println("The Data is Shown Below:)");
}
velocityFile = SD.open("velocityValue.txt", FILE_WRITE);
// if the file opened okay, write to it:
if (velocityFile) {
velocityFile.println("The Data is Shown Below:)");
}
}
void loop() {
myFile.print(F("Temperature = "));
myFile.print(bmp.readTemperature());
myFile.println(" *C");
pressureFile.print(F("Pressure = "));
pressureFile.print(bmp.readPressure() / 100); //displaying the Pressure in hPa, you can change the unit
pressureFile.println(" hPa");
altitudeFile.print("Approx altitude = ");
altitudeFile.print(bmp.readAltitude(1028)); //The "1019.66" is the pressure(hPa) at sea level in day in your region
altitudeFile.println(" m"); //If you don't know it, modify it until you get your current altitude
velocityFile.print("Approx Velocity = ");
velocityFile.print( //This is where I do not know what to do
}
I hope you guys can help, thanks for your time!