Challenge day


Yesterday was a harsh day : I spent most of my time coding for the communication challenge, a challenge designed by our teachers. The goal was to print a maze on a screen through the network and to solve it thanks to an on-board joystick.

The first part was dedicated to network communications : I had to send requests to a server by different ways. First, it was a simple request. Next, I had to send a request very quickly after receiving an url in a packet. Then, I needed to answer questions that was sent to me thanks to a request. In this part, I used the code I did during the last lab and so it was quite fast. However, the solution I used was sometime a bit cheating because, for example, I was not detecting the end of the header. I had to do it later.

Then came the amazing part : the maze ! I began with the screen initialization. It used SPI and I printed a test picture. Next, I received a picture through the network and I printed it on the screen. It was a checkcode to go to the next step. Then, I implemented the joystick : it was quite easy because I did a code similar to the buttons I did during the lab. This joystick woke up a thread that send to request to server to obtain the next position in the maze. Once the maze was completed, I finished the challenge.

I had some difficulties in this last part. First, I do not understand why, but if I do not put a timeout for the reception, my program tries to read infinitely. As I wanted to make fast requests, it was kind of a problem. Next, at the beginning, I had not understood that the screen was larger than what can be seen, just like VGA. So, my picture was moved. To finished, when I used the joystick, I first disabled the interrupts because I did not wanted there to be a joystick update while I was updating the screen. Sam advised me to wait for an event with an immediate timeout, which in fact cleared the flags of an event.

Well, it was really amazing but I was very tired as I needed to be concentrate a lot.

See you !


Facebook Twitter Google+ 

Commentaires fermés.