Week 5 Flashcards

1
Q

debugging

A

correcting the difference between what you want and what the programm actually does

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

how to go about debugging

A
  • First understand and have an expectation of what a program does
  • then extract info: meassure output, look at led’s, check the order in which things are happening
  • review code: what path was executed to produce the output and what went wrong
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

serial debugging

A

serial communication is usefull, keep the following in mind:
- using serial changes the timing of the program
- serial and interrupts do not go hand in hand
- serial is slow

use a debug mode that you can switch on and off

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

how to serial debug

A

debug the smallest portion of code possible
turn of irrelevant code
write debug lines wherever you have doubts and on conditionals and return values
measure what the arduino does

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What to do if there is no serial output

A

check serial port on pc and check baudrate
print a debug line early in the setup
use the built in led to confirm the program is running

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what to do/causes if the program keeps running setup()

A

an error(memory acces or division by 0) causes arduino to crassh
a crash causes a reboot
look at variable declaration and usage
look at the math
variables that are not initialised have random values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

memory basics

A

a computer (memory) stores bits (1 or 0), a group of 8 bits is a byte
a single byte can accomodate 256 states
communication speed is described in bits (lowercase b)
adressable memory is a magnitude of 2 kiB = 1024 bytes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

pointer

A

reserve a piece of memory, it is a stored memory adress and can be initialised using malloc, it needs to be freed manually using “free”, otherwise it will overwrite itself leading to bugs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly