Questions about ethernetUDP programming

Hello guys

I'm working on a project with an arduino mega and ethernet shield.
I have an matrix of 96 buttons and there are 12 vertical lines and 8 horizontal lines.
I want to send an UDP packet over ethernet when 2 digital pins(lines) are together high.
I'm working with the different lines and thats the way i want to send the 96 different UDPpackets for each button.
What is the best way to program this and how i have to program this.
It's the first time i'm doing such thing with the arduino.



96 different UDPpackets

Are the packets all completely different or are they mostly the same except for one or two bytes of data?

Thanks for your reaction on my post!
I hope you can help me with my guestion.
Its data with simple commands to control a device.

The link below is a small document with the remote protocol and the commands


Lustige Leon

They are mostly the same.
It are just a few numbers are different for each button
But the command is the same


Lustige Leon

In general one would use an array of 96 elements. You can have a structure that contains multiple associated data values:

struct buttonData {int buttonType, byte buttonCode} buttonArray[96];

You can get to each field of the structure:

int type = buttonArray[index].buttonType;
byte code = buttonArray[index].buttonCode;

I still don’t understand how you actually program more than one UDP packet. Could you please explain to me step by step how to do this?

Basically, I want to achieve this:
Step 1: When digital pins 22 and 40 are high, then the Arduino should send a UDP packet which contains G8-1.
Step 2: When digital pins 23 and 42 are high, then the Arduin should send a UDP packet G8-2

These two steps are the steps that I should repeat 96 times but with different UDP packets.
Could you tell me how to program this?

Many thanks in advance!