Writing values ibus

Hello! I would like to display the number of GPS satellites on the IA6B receiver, but it does not work. No matter what code I try, it only says 0. What could be the problem? I am attaching my code.
#include <TinyGPS++.h>
#include <IBusBM.h>

#define GPS_SERIAL Serial3 // GPS kommunikáció (TX3/RX3)
#define IBUS_SERIAL Serial2 // iBUS kommunikáció (TX2/RX2)
#define GPS_BAUD 9600

TinyGPSPlus gps;
IBusBM telemetry;

#define IBUS_GPS_SATELLITES 0x0B // iBUS azonosító a műholdak számához

void setup() {
Serial.begin(115200);
GPS_SERIAL.begin(GPS_BAUD);
IBUS_SERIAL.begin(115200, SERIAL_8N1);

telemetry.begin(IBUS_SERIAL);
telemetry.addSensor(IBUS_GPS_SATELLITES);  // Regisztráljuk a GPS műhold szenzort

Serial.println("✅ GPS és iBUS telemetria elindult...");

}

void loop() {
while (GPS_SERIAL.available() > 0) {
gps.encode(GPS_SERIAL.read());
}

static unsigned long lastUpdate = 0;
if (millis() - lastUpdate > 2000) {
    lastUpdate = millis();

    if (gps.satellites.isValid()) {
        uint8_t satCount = gps.satellites.value();
        telemetry.setSensorMeasurement(IBUS_GPS_SATELLITES, satCount);
        telemetry.loop();

        Serial.print("📡 GPS Műholdak száma: ");
        Serial.println(satCount);
    } else {
        Serial.println("⏳ Nincs érvényes GPS adat!");
    }
}

}

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

Please post your sketch, using code tags when you do

Posting your code using code tags prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination

In my experience the easiest way to tidy up the code and add the code tags is as follows

Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

It is also helpful to post error messages in code tags as it makes it easier to scroll through them and copy them for examination

Hi @zsolt9326 . addSensor() returns the address of the sensor added. You should use the returned value as the first argument in setSensorMeasurement(). Like this:

sensorAddr = telemetry.addSensor(IBUS_GPS_SATELLITES); 
...
telemetry.setSensorMeasurement(sensorAddr, satCount);

Hi! I am looking for a code writer for ibus communication between 2560 mega and ia6b

Is this something that you are willing to pay for ?

$ 250 USD / hour minimum 3 months 50% upfront plus all expenses.

funny... I really just want to ask for help, but I don't see it as easy

I think there is a pinned post somewhere that tells you how to ask a software question. We need a lot more information than what you supplied.

How much have you written so far ?

Which Arduino board are you using ?

Does this help:

Check out the included examples to see if they can get you started.

I use a 2650 mega card, I managed to get the sensor to appear on the remote control, but it only shows the value 000. unfortunately, I can't write a value with it with any code

Please post your sketch, using code tags when you do

I have merged your forum topics due to them having too much overlap on the same subject matter @zsolt9326 .

In the future, please only create one topic for each distinct subject matter and be careful not to cause them to converge into parallel discussions.

The reason is that generating multiple threads on the same subject matter can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Thanks in advance for your cooperation.

Hi @zsolt9326 . Please see post #3 for solution (in case you've missed it in the merge).

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.