14 Feb
14Feb

This month I did a lot of work, enriched my knowledge and insight, my work was to  complete the line-following programming, SWITCH-MODE programming and the most important code (Battle mode) !

I have made many modifications to the line-following programming, and many problems have been solved.

At first, I wrote with my own ideas, but I met many difficulties. Then I received the sample code, which was very clear. I combined this program with our previous program, and it didn't work very well. Then my teammates and I understood that it was because of the threshold of LDR, so we measured it, and we set four thresholds of LDR in the program, and set white as high voltage, which is logic 1 and black as low voltage, which is logic 0.  In the process, I learned that the AND Boolean statement is used to activate the corresponding bits, e.g. if ((ADCMAP & 0b00001111) == 0b00001110){DRIVE = SFL;}. This freed my mind in the later programming, and made it easy for me to handle the switch code to switch between combat Mode and line-following mode of the ‘little mice’. 

Then I started working on the battle mode code, thinking that the function would be implemented by just swapping the 0 and 1 in the following part of the code with white-line. But unfortunately it failed. After summarizing the reasons, I found that many cases were not taken into account.So I drew the actual strict image of the arena and listed every possible scenario, and then definesd many new functions, such as made our mouse can implement the function of the brake and  the rotation 'comspin ()'. so that it can avoid being collided outside by other mice, also avoid falling into the 'cliff' of the new arena.

Then after reading of the guidance documents, I knew battle mode strictly according to certain priorities, and the order was to stay in the arena, our touch bar colliders with the enemy electric mouse, IR detects the enemy infrared signal. So the easy way to do this was to put the codes for the functions in the for loop in the order described above. This solved the priority order.

Now, our mouse warrior, is ready to fight!!


Comments
* The email will not be published on the website.
I BUILT MY SITE FOR FREE USING