Lecture 7 - TTGO Flashcards
How do you set TTGO to read/take an input (external)?
pinMode(26, INPUT) -> this will connect to pin 26 on the TTGO and set it to an input pin. This is an exeternal pull up resistor (ie when an external resistor is added
x = digitalRead(26) -> will read the data from pin 26
How do you set TTGO to read/take an input (internal)?
pinMode(26, INPUT_PULLUP) -> this will connect to pin 26 on the TTGO and set it to an input pin. This is an internal pull up resistor (ie when the internal resistor in the TTGO is used)
x = digitalRead(26) -> will read the data from pin 26
How do you set TTGO to write/output?
pinMode(27, OUTPUT) -> this will connect to pin 27 on the TTGO and set it to an output pin.
digitalWrite(27, HIGH) -> can put LOW or HIGH but HIGH means on and LOW means off
What code do you use for displaying things on an LCD?
The library you use is TFT_eSPI.h (header file as we code in c)
the call if tft. this can be followd by:
1. init() to initialise
2. setTextSize(value) to set size of text
3. drawString(“text”, 0, 0) ro draw text at column o and row 0
4. setTextColor(TFT_BLACK) to set text to black
5. fillScreen(TFT_BLACK) to set background to black
When does a switch bounce occur?
When pushing a button