Defense-SA

Introduction:

In HTMAs: introduction of engineering, I learnt Arduino fundamental knowledge. Arduino is based on C++ language and I have learned some C++ stuff as well. After those BL experience, I think I can develop my own Arduino, I chose this electronic dice. Not only is it particularly to bring a lot of fun to my life, but also learn more about Arduino through this project.

Preparation:

So I searched online for information about using Arduino to do electronic and found a very clear logic. First of all, we divide arduino into two aspects: hardware/software. Among them, I need to design the Input/Output part, and tell Arduino how to operate these inputs and how to output.

For the part of electronic dice that I want to do, I went to the tutorial and found that in fact everyone’s logic is similar. Most of them are switch control of an eight-bit digital tube, and then use random, the function to output an array set in advance. In the process of writing the program, I listed such a framework so that I can sort out the logic and think about what function to use:Pic

During:

A good program, or a program that we think is very divine, generally has a clear framework, and each sentence of code has a very clear directivity. A lot of tedious or wrong code can be deleted completely, and keeping the code beautiful is also very important. So I have renovated my code again, and it seems that it is more beautiful and concise.

In the process of writing code, there is a function that needs to generate random numbers, but I found that I would not write this. So I went to ask Daniel He, he told me not to search the Internet first, and then recommended a blog about random functions to me. Among them, through studying and discussing, I understand that the random function is actually generated by some variable but undetectable data, such as

srand((unsigned)time(NULL));

This is generated by the time of the system. Changes in time are not well measured, and not particularly delicate operations are not enough to output predictable numbers.

最后的程序大概是这样的:

After writing the program, it is time to design the hardware.
Because the process is boring and has no nutrition, it is omitted first. Put the picture directly

Debug:

  • 2C: Troubleshooting Systems
  • 2D: Transfer current knowledge to learning of new technologies

After finishing the code and hardware design, I am very happy. So I did a test immediately and clicked upload. Thankfully there are no bugs or errors. But I remembered that in the MakerSpace workshop this semester, Daniel mentioned a problem with the hardware. For example, a switch, we assume that 0 is the switch is pressed, 1 is the switch is not pressed. When detecting the state of this switch, the ideal state should be 1111111100000001111, and the fact is 1010111100101001011. That is to say, the button will sometimes be inaccurate, and it will output random 0s and 1s.
So I took advantage of the trash-hold that Daniel taught me at the time, and used the discontinuity of the bug to eliminate the bug.

  • 2B: Use Applications Effectively

But the trash-hold is very troublesome, not only is it long to write but also has many variables. In this regard, I found Daniel and discussed another method with him, using delay and if statements to judge. This will solve the problem with only a few lines. And received Daniel’s approval. I used and selected the program effectively.

Pic

  • 9F: Using feedback to improve learning

hen I found that this program still has a big bug, and my electronic dice will only output the number 4. Asked Jaguar, and got some feedback:

Pic

It’s a pity that I can’t go back to the MOONSHOT. I can’t solve the bug temporarily, which makes it inconvenient for people to watch online. So at present this is only a semi-finished product, which is a pity.

Video

Reflection:

I want to talk about where I am doing well and where I still need to improve what I do well:
1. I am a little white, and can complete the production of electronic dice relatively independently through the tutorial, which is well used in the transfer current knowledge to learning of new technologies competency
2. During the production process, I found the content that I wouldn’t know, and asked the big brother for help. The problem was quickly solved, and I learned new knowledge from this process.
3. When encountering the button problem, I chose a more optimal method and applied it to Use Applications Effectively
Finally, I tested it through Jaguar’s feedback, Using feedback to improve learning. Although it did not solve the problem, I learned the debug method.

Still need to improve:
1. Being too lazy at home has caused this project to be a bit slow and a bit delayed. The efficiency at home should be improved, try not to fall into a state of being too comfortable
2. Insufficient preparation, start to do it without understanding. At the beginning, I didn’t write the framework, which caused my code to be very confusing. Later, it took a lot of time to sort out the logic and did a framework.Next time I will use the frame directly.
3. For the bug, it has not been finally solved, the code is written in a normal way, you still need to find someone to improve it, but it is not complete and sufficient

  • I need more feedback, especially from Jaguar. There are still mistakes in many places, I need to seek feedback more actively to improve better.

More stuff(not related to competency model and I want to let you know)

This is actually not a very successful project, it is equivalent to I spent a lot of events to make a semi-finished product, and it is not difficult (at least from the current perspective). However, I feel that I still have gained a lot. As mentioned above, I will not repeat it. I will not discard these Arduino stuff, I will continue to learn them, I really feel very cool and interesting. I will do more things in the future, and the difficulty will be much greater than it is now. This is just a small step I have taken. Just wait and see!

Leave a comment

Your email address will not be published. Required fields are marked *