Have you received anything from your iBus connection?
What Arduino board are you working with? If you only have one serial port, you can't use that for both debugging and getting characters from another serial source.
If you have only one real port, it is possible that you could use a SoftwareSerial port to talk or listen to you iBus.
What is the iBus baud rate? I think it is true TTL serial protocol, not inverted like sbus.
Or is the other way 'round?
Until you can receive anything, it makes no sense to try to parse and handle specific transmissions.
good point. def needed a SoftwareSerial port to talk or listen to you iBus. im 80 percent self taught and 20 percent YOUTUBE. this is my first time using forum. thank you for being so quick and insightful
thank you, i changed the code with a ibus 10ch read i found online. im not a fan of copy and paste but i have alot more to do with my odrive HoverBot i created so copy and paste works till i get further in my project,
BTW im using arduino mega. i just needed a way for rc controller to tell arduino to talk to my Odrive v3.6 differential drive. the arduino and odrive talk threw uart. i needed a way when hitting a switch on my rc controller can tell odrive to auto configure and then trigger a 4 Relay for lights and to switch to secondary battery on the go while switching itself
I think it might. It looks like it should. I did not run the code, so.
Try tracing the code starting with ibusIndex 0 and assuming that the next two characters you read are exactly 0x20 and 0x40.
Simplified logic here:
if (Serial.available())
{
uint8_t val = Serial.read();
// Look for 0x2040 as start of packet
if (ibusIndex == 0 && val != 0x20)
{
ibusIndex = 0;
return;
}
if (ibusIndex == 1 && val != 0x40)
{
ibusIndex = 0;
return;
}
if (ibusIndex == IBUS_BUFFSIZE)
{
// do a buncha stuff but ultimately
return;
}
else
{
ibus[ibusIndex] = val;
ibusIndex++;
}
}