Can I use a ATtiny85 board (eg Digispark) as a USB CDC device?
If I have got this right, to be able to communicate with a USB serial device you need to have USB CDC support and if you want it to fake a keyboard/mouse you need HID.
The Digispark have a CDC library https://digistump.com/wiki/digispark/tutorials/digicdc
But it has its limitations, take ...
Under-voltage detected! I think it says it all. Rapsberry have many times problem to feed itself from "common power source", not mentioning attached devices. Especially, if you power your LEDs from it too.
You need better power source for Rapsberry (and maybe even power it from pins, but then you need read much more to not damage it) and other powersource ...
The problem is that serial.write will block if the buffer is full.
Only until the bytes get sent out through the TX pin.
If I skip writing if the buffer is full, a receiver will only get old data on the first connect.
No it won't. There is no "old" data.
How can I replace data in the buffer or make sure there is only one dataset in the buffer?