Ok, so where was I? Reviewing my microcontroller class… I talked about RGB and PWM…
Next we explored output – how to see information from the teensy about what it is doing. You can choose “serial monitor” which will output information to a screen on your pc if the teensy is hooked to it. Further in the code, you can specify what type of output the teensy will show. With the coding “serial.print” and a message, you’ll see the message you identified being printed on the serial monitor. Changing the program while using other microcontrollers can make this information much more interesting and useful. For example, attaching a pushbutton, potentiometer, or thermistor will provide new information to the teensy which can be viewed or manipulated on the serial monitor. So, you can program the chip to read when a button is pushed or not pushed and have it use the serial.print to output certain text in response to each condition. With an analog microcontroller, you can have the serial.print output analog information to the serial monitor using the analogread function. Then you can even apply equations to the data to show a new value – you’d have to do this if you want to see temperature as measured in Ferinheight from the thermistor.
Pushbutton: In the set up we learned in the class, the pushbutton acted as an “active low”, which Paul described as having a “signal [that is ] low when the condition is happening” meaning when you or the environment acts upon the teensy system, the amount of voltage cycling through the system is low or (in my mind) broken. So, in this case, when you push the button you are breaking the electricity cycle.
I am still a bit confused about the “pull-up” nature of this button in this situation. Looking at the tutorial, there’s a resistor that we put across the breadboard between the button on the plus side and over to the negative side. So, I’m thinking that, when you push the button and interrupt the flow of electricity, when you let go of the button sometimes the electricity doesn’t start cycling again. The resistor is holding a little bit of electricity which gets pulled into the button when you let go, maintaining the cycle. Kind of like, if you’re siphoning water out of a fish tank and you pull the high end of the tube out of the water all the water in the tube falls down the low end and you have to start the siphoning all over again. The resistor is sort of like your thumb over the end? Maybe? Not really, because it isn’t working to stop the flow or maintain the pressure in the tube, but kind of like that. That’s not an ideal analogy for that, but it works for my brain!
Potentiometer: This is a resistor that lets you change how much voltage gets let through. It’s considered analog because you can have increments rather than just “on/off”. In our tutorial, we used it to change the bulb color from green to red and back. Using the programming, the board sensed how much voltage was being let through from the potentiometer and then it changed the amount of color in response.
Temperature Sensor (thermistor): this is really simple to install. It’s a resistor that changes how much voltage can pass through it depending on the ambient temperature. Therefore, the teensy can measure the voltage as an analog input and then use the analogread to show how much voltage is passing through. This number doesn’t make much sense to us, though, because we use the farenheight or Celsius scales most commonly, so add some equations to convert into the familiar scales. Wa-la! Super easy!!