11. Programming (5) Flashcards
Why do we need to use the serial interface?
To get things started and to print data
Function for setting things up using the serial port?
Serial.begin()
Function for printing using the serial port?
Serial.print()
Function for printing and starting a new line using the serial port?
Serial.println()
How can you debug using the serial port?
By printing values of variables at certain locations you can trace what is going wrong.
If there is nothing wrong with your program what else could be wrong?
There could be something wrong with the hardware: maybe how it is connected/ connected to the wrong pin. If not, then look elsewhere, what happens next in your program?
What are the advantages and disadvantage of debugging using print statements?
Disadvantage: not very elegant
Advantages: simple and often very effective
What must you remember to do after using print statements for debugging?
Delete all the print statements afterwards
What is another option for debugging?
More advanced debuggers exist, these let you step through your code line by line, to see what is happening at each step.
What is an example of an advanced debugger?
Uno Ardu Sim, a free arduino uno simulator
How can the monitor be used for a more useful application?
Can be used as a simple datalogger
What is a datalogger?
A system that collects information and lets us download it to a computer when we are ready
What does the hardware setup look like to investigate switch bouncing?
DRAW
What happens when the pushbutton is pressed?
It acts as an analogue input at the upper pin and as a digital input at the lower pin
Should we use the built in pull up resistor here? What value should the resistor roughly have?
R should be low (about 2kOhms) since this is the input impedance to the ADC. For this reason we do not use the built in pull up resistor.