Thursday, December 15, 2016

Reflection of class on Dec 15th
  As the beginning of this chapter 8 says, “like a mad scientist bringing something to life, in this chapter you’re going to embark on a project to wire up a new sense of touch for your Pi.”
  It means that the Pi can be more interactive to do some automatic work according to the button presses by users, like a proximity sensor to detect when someone is walking nearby. Artificial intelligence is getting hotter and hotter, now many robots for education such as Dash and Dot, LEGO Mindstorms EV3 can react to the motion of players and do easy communication with them. So letting the Pi have similar sense like human is a better way to make programming more creative.
  The ambition of this chapter is making Pi a musical computer that plays different sounds when we press buttons, so the first thing I need do was adding two buttons and new resistors to the solderless breadboard to create a new circuit. It’s not difficult to do that by following the example steps as long as all the connectors are all placed tightly in right position. And the circuit could only be connected to a whole which allows the flowed electricity when button is pressed by users, that is, two buttons represent two different circuits which can lead to different reflection of procedure. So here the circuit was the input of signal, not the output.
  I don’t want to talk more about the procedure because it’s just a simple sequence structure with condition selection which could choose sounds or vocals randomly from different lists according to the received electrical signal.

  It was a pity that I couldn’t see how the entire procedure worked with music output because I don’t have corresponding headphone to do that. But I know the procedure could work well because I was so prudent when I programmed this procedure.

Wednesday, December 14, 2016

Reflection of class on Dec 13th
  Well, it’s really a wonderful guessing game that the unique red, green, blue light-emitting diode can blink in different color as the reflection to the guess made by players, that is, the red light will blink for 5 times in almost 1 second when players input a number higher than the default number provided randomly by procedure, the blue light will blink when the guess number lower than default, the green light will blink when the guess number is matching the default.
  It sounds so good, but actually it’s too difficult for me to design and program a corresponding procedure to let this guess game be interactive and interesting without any blemish. So I follow the steps in the example and type relative codes in Python 3 editor interface seriously with detailed annotation. You know, it’s not a simple and easy program.
  And before I began to program, I need to assemble a new physical circuit to make sure the 3 color light-emitting diode can work successfully when it receives the electrical signal from GPIO when the procedure transfers the pins. All the operations to the new circuit were similar with last circuit except the diode, there are four legs which represent different color of the light, that is, the longest leg connects toward the negative, two legs around the longest one represent red and green light, the shortest leg represents blue light. So, I had to pay attention to this item and insert four legs to the right holes of the solderless breadboard to make the circuit to an entire loop.
  To be honest, the example procedure was not so difficult to understand, I can completely make sense about every line of codes though I took almost 1 hour to do that. What I confused about was that I couldn’t run my procedure successfully after I typed in all the example codes, there was an error information appearing said that ‘EOL while scanning string literal’ when I pressed the F5. I checked all the codes about string and tried many times to figure it out but the error was still there so that I couldn’t see how the new diode work.

  I was so sad about this till the ending of the class because my classmates had run the procedure very well. Fortunately, I found I typed an extra quotation at the end of ‘intro’ string and the procedure worked perfectly after I deleted that. I think I need to be more prudent when I program the procedure next time.

Monday, December 12, 2016

Reflection of class on Dec 6th
  As we all know, our course in this semester is named as ‘computer architecture’. We have assembled the basic Raspberry computer at the first time we got the initial box with parts of components inside and did programming on Python 3 to create various images and fabulous interactive games, what’s more, we can also surf the Internet or listening music as other normal computers.
  And this chapter 6 of ‘Hello Raspberry Pi’ really showed us how to promote our little computer physically by adding some useful widgets such as ribbon cable, breakout board, solderless breadboard, jumper wires in different length, light-emitting diodes (LEDs) with different colors and resistors which have 180 ohm color bands.
  Actually, what we did in class was expanding the GPIO of little computer to make diodes blinking in particular ways. We connected the GPIO with breakout board by ribbon cable to make sure electrical signals could be transmitted successfully between computer and breakout board. There were numerous holes on solderless breadboard used for holding diodes and resistors, and I had to pay attention to the position of positive and negative pole so that there would be an entire circuit as long as I inserted the diodes and resistors.
  I don’t want to talk more about the physical circuit because I did so bad in learning physical circuit in high school, fortunately, I did well in programming the procedure on Python 3 to control the blinking of diodes.
  As usual, I typed the codes from example to the interface of text editor and pressed F5 to run it and saw how it worked. The diodes blinked as expected, that is, I could control different colors of diodes to blink in different orders and adjust the initial program to let them blink randomly by implementing random import. Everything was perfect except an error message which always appeared after running said there was something wrong in GPIO BCM set. But I don’t need to worry about it because this error wouldn’t influence the function of procedure.