Tutorial 2 on Wrapping Up for Intel® Galileo Boards
Our bodies are, in a sense, powered by electricity. By using a capacitive touch sensor, we are able to use the electrical capacitance of our bodies to activate the usage of the microphone.
Using the PWM pins denoted with a ~ next to the pin number, we were able to simulate an analog pin as an output using the boards' special PWM digital pins. This gives us the ability to output values between 0-5 V, represented by the number range 0-255. Using these values, we are able to adjust the brightness of an LED.
Writing code can get messy. Using functions can help your code be easily readable by other developers. Using common practices and guides helps you and your team write and understand efficient code.
Writing function signatures before writing the code for the function is a good first step in determining what you want to accomplish. Once a signature is established, writing the actual code will be easier.
Challenges
- How would you modify the code in the last sketch to improve readability?
- When and why would you use a function of type void?
- What if you wanted to have the microphone turn off when the capacitor receives a high input?
- How would you update the code to do so?
- Instead of using an if/else statement, how would you use other control structures to achieve the same results? See Control Structures in the Arduino reference documentation.