Code is here:
Code: Select all
// Pressure Sensor test code 7/30/22 Leo Wang, revised by Diane Brancazio
// Overview of product at https://learn.adafruit.com/lps35hw-water-resistant-pressure-sensor
// You will need to install the Adafruit LPS35HW Library and the Adafruit BusIO library
// using the Library Manager in the Arduino IDE.
//
//Connections and wiring notes. Uses Serial Peripheral Interface (SPI) Logic
//Vin - power in from Arduino - connect to 5V (3.3V is ok too)
//GND - Ground from Arduino
//SCK - This is also the SPI Clock pin, its an input to the chip
//SDO (MISO) - this is the Serial Data Out / Microcontroller In Sensor Out pin, for data sent from the LPS35HW to your processor
//SDI (MOSI) - this is also the Serial Data In / Microcontroller Out Sensor In pin, for data sent from your processor to the LPS35HW
//CS - this is the Chip Select pin, drop it low to start an SPI transaction. Its an input to the chip
#include <Adafruit_LPS35HW.h>
Adafruit_LPS35HW sensor = Adafruit_LPS35HW();
#define LPS_CS 8
#define LPS_SCK 13
#define LPS_MISO 12
#define LPS_MOSI 10
float temperatureC, pressure_hpa, pressure_psi;
void setup() {
//starting the serial monitor, which can be found in "Tools"
Serial.begin(115200);
while (!Serial) { delay(1); }
sensor.begin_SPI(LPS_CS, LPS_SCK, LPS_MISO, LPS_MOSI);
sensor.zeroPressure();
}
void loop() {
//retrieving and printing the temperature detected onto the monitor
temperatureC = sensor.readTemperature();
Serial.print("Temperature: ");
Serial.print(temperatureC);
Serial.println(" C");
//retrieving and printing the pressure detected onto the monitor
pressure_hpa = sensor.readPressure();
Serial.print("Pressure: ");
Serial.print(pressure_hpa,3);
Serial.println(" hPa");[url][/url]
//Senses temperature and pressure every half a second
delay(500);
}
So my question is, how can I use this board relialy with the SPI or I2C interface, over a 30' cable? thanks!