stm32 ile c# bağlantısı yapmak istiyorum . Stm32 ye bağlı bmp280 sensörüm var . Arduino ide port ekranında verilerimi çok sağlıklı bir şekilde alıyorum . Fakat bu verileri c# aktarmam gerekiyor . Baund 9600 kullanıyorum . Seri port bağlantısı yaparken bağlantıyı açmıyor . Hata veriyor . Bu aygıt çalışmıyor hatası alıyorum . Aynı kodları arduino ile sorunsuz bir şekilde çalıştırıyorum .Yardımcı olursanız sevinirim .
bmp280 ide tarafı kodlarım :
/////////////////////////////////////////////////////////////////////////////////////////////////////
// BMP280_DEV - I2C Communications (Alternative Address), Default Configuration, Normal Conversion
/////////////////////////////////////////////////////////////////////////////////////////////////////
#include "base64.hpp"
#include <BMP280_DEV.h> // Include the BMP280_DEV.h library
float temperature, pressure, altitude; // Create the temperature, pressure and altitude variables
BMP280_DEV bmp280; // Instantiate (create) a BMP280_DEV object and set-up for I2C operation
void setup()
{
Serial.begin(115200); // Initialise the serial port
bmp280.begin(BMP280_I2C_ALT_ADDR); // Default initialisation with alternative I2C address (0x76), place the BMP280 into SLEEP_MODE
//bmp280.setPresOversampling(OVERSAMPLING_X4); // Set the pressure oversampling to X4
//bmp280.setTempOversampling(OVERSAMPLING_X1); // Set the temperature oversampling to X1
//bmp280.setIIRFilter(IIR_FILTER_4); // Set the IIR filter to setting 4
bmp280.setTimeStandby(TIME_STANDBY_2000MS); // Set the standby time to 2 seconds
bmp280.startNormalConversion(); // Start BMP280 continuous conversion in NORMAL_MODE
}
void loop()
{
if (bmp280.getMeasurements(temperature, pressure, altitude)) // Check if the measurement is complete
{
/*char normal_text[50];
unsigned char base64_text[50];
int base64_length;
sprintf(normal_text, "T= %d", int(temperature));
base64_length = encode_base64(normal_text, 49, base64_text);
Serial.println((char *) base64_text);
sprintf(normal_text, "P= %d", int(pressure / 100));
base64_length = encode_base64(normal_text, 49, base64_text);
Serial.println((char *) base64_text);
sprintf(normal_text, "AL= %d", int(altitude));
base64_length = encode_base64(normal_text,49, base64_text);
Serial.println((char *) base64_text);*/
Serial.print(temperature); // Display the results
Serial.print(F("*C "));
Serial.print(pressure);
Serial.print(F("hPa "));
Serial.print(altitude);
Serial.println(F("m"));
}
}