6/30/2015

Second Day

Today, our group continued our work with the arduino parts. I worked with Kevin about how certain parts were to function from a large arduino piece kit with a pyboard as well as learning different coding/classes in the microPython language. My favorite function that we solved was this module:
 
"Big Sound"
(Technically it is a microphone sound sensor module, but the kit it came from labeled it as Big Sound, so that is what I will call it)

When reading the label, you would expect it to be a module that would emit a "big sound", but after many trials (and to my personal dismay), it is actually a type of microphone. It is not a very sensitive microphone, but you could change the sensitivity of this module (and many others) by screwing the yellow screw around. We didn't experiment much on this, however, so maybe you (the reader) could check this out!

 The largest thing I learned today, and will be focusing on, would be the class Pin in microPython. 
(g= variable name, pyb.Pin('location where the module is connected to the pyBoard', if the module will return(.IN) or display information(.OUT))

I've also learned that there are different types of Pin.OUT, there being .Pin.OUT_PP(push-pull) and .Pin.OUT_OD(open drain). PP uses 2 transistors while OD uses 1, however using PP responds faster than OD, so I've always used that.

There are also different modes one could set a .Pin to. One would be what I believe is default which works sort of like a boolean but instead of True and False it would be in the form of a high and low logic level(also returns 0 and 1, but I am unsure which number relates to which level) . Ten there is .ANALOG, which has more numbers to work with rather than 0 and 1. At the moment I am sort of fuzzy on how the whole.ANALOG thing works, but I will try to explain as much as I know.
(note that defining something as .ANALOG and something as .IN/.OUT are different things, I am to look more into the differences later)

Using .ANALOG would work for things that require more data output (as in a microphone on how much pressure would go into a mic), and using the default would be helpful for things like an on-and-off switch.

If you wanted to obtain data, from lets say g, you would have to use pyb.Pin.value(), since value() is to return 0 or 1, depending on the logic level. However, if you wanted to see data from h, you would have to use pyb.Pin.read(), which is like value() but reads .ANALOG data.
(from experimentation and help from Kevin, we figured out some commands such as these)

I've learned so much today, and I wish I could add more about how we figured out how we retrieved data from Big Sound, but unfortunately I was unable to figure out how to screenshot pictures until recently and I do not have the avaliable tools with me right now. Tomorrow is going to be a busy day, however, since I will have to work with George on figuring out on how the rest of the modules will work!

~~Links~~
link used to learn more about pyb.pin <- and also where I got some pictures about .Pin from :v
link of forum explaining more about PP v OD
 
 


1 comment:

  1. Wow! This post is great. Please make many more like it. Today you will be working with Aki to set up git and create a github account. You will also install python3-sphinx, and learn to use the sphinx documentation system to make an on-line book.

    I setup a shell for the book we are hoping to start this Summer here:

    https://github.com/jelkner/pyboard_by_example

    You can see what it looks like on the web once rendered here:

    http://www.openbookproject.net/tutorials/pyboard/

    Since you can clearly write well and express technical ideas clearly, I wonder if you would be interested in helping us create this tutorial?

    ReplyDelete