ESP - Week 3 Flashcards
1
Q
What do #define UP 1 and #define DOWN 2 do
A
Everything UP or DOWN is replaced by 1 or 2 respectively
2
Q
Macro pre-processor Syntax
A
#define (original) (replace) no semi colon
3
Q
Define a two argument macro
A
define twoargmacro(a,b)
4
Q
Declaring functions
A
output function_name(input){}
5
Q
Button masks
A
#define BUTTON_UP 0x08 #define BUTTON_DOWN 0x04
6
Q
Fixing button up and button down
A
both_pressed = (x & BUTTON_UP) && (x & BUTTON_DOWN)
OR
both_pressed = x & (BUTTON_UP | BUTTON_DOWN)
7
Q
Difference between & and &&
A
& = Bitwise And && = Logical And
8
Q
What is Bitwise OR
A
|
9
Q
What is Polling
A
When we continually check if something has changed
- busy wait
- low level
10
Q
What is an event
A
When we wait for something to happen until one of them does
- high level
11
Q
Arduino Buttons
A
lcd.readButtons() - returns the current state of buttons