Hello everyone,
It's been a while since my last visit I'm still learning
I try to make it show me the distance on my Flysky radio. Everything is working correctly shows me 200m according to this rating is below. Ibus Servo also works when I switch the switch, the LED on my board lights up. The problem is the GPS does not show me the data on my LCD about the number of satellites. But as from the code below I'll comment these two lines:
\\ IBusSensor.addSensor(IBUS_MEAS_TYPE_GPS_DIST);
\\ IBusSensor.setSensorMeasurement(1, 200);
The LCD shows the number of satellites ...
I have no idea what is wrong with these two elements getting stuck, ie GPS cannot work when IbusSensor is used.
I do it on separate TX / RX and I don't know where the error is. Maybe one of the honorable users with more knowledge would advise me something.
Thank you in advance for your help
below all code:
#include <TinyGPSPlus.h>
#include <SoftwareSerial.h>
#include <Wire.h>
#include <LiquidCrystal_PCF8574.h>
#include <IBusBM.h>
static const int RXPin = PA10, TXPin = PA9;
static const uint32_t GPSBaud = 9600;
// The TinyGPSPlus object
TinyGPSPlus gps;
// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);
// For stats that happen every 5 seconds
unsigned long last = 0UL;
//LCD
LiquidCrystal_PCF8574 lcd(0x27); // set the LCD address to 0x27 for a 20 chars and 4 line display
IBusBM IBusServo;
IBusBM IBusSensor;
HardwareSerial Serial6 (PA12, PA11); //RX, TX
HardwareSerial Serial2 (PA3, PA2);
void setup()
{
ss.begin(GPSBaud);
Wire.setSDA(PB3);
Wire.setSCL(PB10);
Wire.begin();
Wire.beginTransmission(0x27);
lcd.begin(20, 4); // initialize the lcd
lcd.setBacklight(255);
lcd.home();
lcd.setCursor(0, 3);
lcd.print("SAT:");
IBusServo.begin(Serial6);
IBusSensor.begin(Serial2);
IBusSensor.addSensor(IBUS_MEAS_TYPE_GPS_DIST);
IBusSensor.setSensorMeasurement(1, 200);
}
void loop()
{
if(IBusServo.readChannel(8) == 1500)
{
pinMode(LED_BUILTIN, OUTPUT);
}
// Dispatch incoming characters
while (ss.available() > 0)
gps.encode(ss.read());
else if (gps.satellites.isUpdated())
{
lcd.setCursor(0, 3);
lcd.print("SAT:" + String(gps.satellites.value()));
}
}