As you can see we have several packets of length 91 byte with data in them.
If we look at HID data of several of those packets we can notice there is a static part and a dynamic part.
Let's discard the static part and work with dynamic one. For example f40101fc08 can be decoded as following:
- 01f4 - time offset (we can discard it for this task, since it doesn't influence the result)
- 01 - ID of the servomotor
- 08fc - servomotor current position
Let's decode it and write out first 15 commands:
Time Offset |
Servo ID |
Servo Position |
500 |
1 |
2300 |
1500 |
2 |
1300 |
1500 |
3 |
1700 |
1500 |
4 |
2500 |
1500 |
5 |
1600 |
1500 |
6 |
1500 |
500 |
1 |
2400 |
1000 |
2 |
1500 |
500 |
3 |
1500 |
1000 |
2 |
1300 |
500 |
1 |
2300 |
1500 |
2 |
1300 |
1500 |
3 |
1700 |
1500 |
4 |
2500 |
1500 |
5 |
1600 |
1500 |
6 |
1500 |
As you can see there are 6 servomotors with ID and possition appearing in this list.
We can remove motors 4,5,6 since they have constant position through the whole file. For the sake of simplicity let's assume they are a character break where our arm switches to writing next character.
This leaves us with motors 1,2,3.
Motor 1 has two possible values([2300,2400]). If we look at the arm scheme and arm images we can see that motor 1 closes and releses the clamp, so, probably, it controlls button on the laser engraver.
So 2300 will be "laser off" mode and 2400 will be "laser on" mode.
Motor 2 controls horizontal movement and motor 3 controlls vertical movement.
Knowing all of this let's write a program that will draw our flag: