mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
73 lines
1.3 KiB
C++
73 lines
1.3 KiB
C++
//
|
|
// FILE: MS5611_deviceID.ino
|
|
// AUTHOR: Rob Tillaart
|
|
// PURPOSE: demo application
|
|
// DATE: 2022-01-22
|
|
// URL: https://github.com/RobTillaart/MS5611
|
|
|
|
|
|
#include "MS5611.h"
|
|
|
|
// BREAKOUT MS5611 aka GY63 - see datasheet
|
|
//
|
|
// SPI I2C
|
|
// +--------+
|
|
// VCC VCC | o |
|
|
// GND GND | o |
|
|
// SCL | o |
|
|
// SDI SDA | o |
|
|
// CSO | o |
|
|
// SDO | o L | L = led
|
|
// PS | o O | O = opening PS = protocol select
|
|
// +--------+
|
|
//
|
|
// PS to VCC ==> I2C (GY-63 board has internal pull up, so not needed)
|
|
// PS to GND ==> SPI
|
|
// CS to VCC ==> 0x76
|
|
// CS to GND ==> 0x77
|
|
|
|
MS5611 MS5611(0x77);
|
|
|
|
|
|
uint32_t start, stop;
|
|
|
|
|
|
void setup()
|
|
{
|
|
Serial.begin(115200);
|
|
while (!Serial);
|
|
|
|
pinMode(LED_BUILTIN, OUTPUT);
|
|
|
|
Serial.println();
|
|
Serial.println(__FILE__);
|
|
Serial.print("MS5611_LIB_VERSION: ");
|
|
Serial.println(MS5611_LIB_VERSION);
|
|
|
|
if (MS5611.begin() == true)
|
|
{
|
|
Serial.print("MS5611 found: ");
|
|
Serial.println(MS5611.getDeviceID(), HEX);
|
|
}
|
|
else
|
|
{
|
|
Serial.println("MS5611 not found. halt.");
|
|
while (1)
|
|
{
|
|
digitalWrite(LED_BUILTIN, HIGH);
|
|
delay(1000);
|
|
digitalWrite(LED_BUILTIN, LOW);
|
|
delay(1000);
|
|
}
|
|
}
|
|
Serial.println("done");
|
|
}
|
|
|
|
|
|
void loop()
|
|
{
|
|
}
|
|
|
|
|
|
// -- END OF FILE --
|