Skip to content

Packet not received #23

@gordon13

Description

@gordon13

I'm trying to send a packet from Python to the Arduino but the handler is never triggered. Maybe I misunderstand the packet format?

I'm using the COBS library to encode the data. Here's the packet as it is sent using the standard python serial library:
b'\x03\x01\x04\x00'

Here's the Arduino code:

#include <PacketSerial.h>
PacketSerial myPacketSerial;

void setup() {
  myPacketSerial.begin(9600);
  myPacketSerial.setPacketHandler(&onPacketReceived);
}

void loop() {
  myPacketSerial.update();
}

void onPacketReceived(const uint8_t* buffer, size_t size)
{
  uint8_t tempBuffer[size];
  memcpy(tempBuffer, buffer, size);
  uint8_t id = tempBuffer[0];
  myPacketSerial.send(id, 1);
}

Why am I not getting anything back?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions