Classwork
Classwork
Skeleton code
Remember to add the function prototypes in main.c
for the declaration of the functions, as follow:
Task 1 :GPIO
When
BTN1
is held,LED1
should be on. (@1)When
BTN2
is held,LED2
should be flashing (toggle in 50ms).(@1)When both
BTN1
andBTN2
are held, the following sequence is conducted:(@2)LED1
andLED3
are on whileLED2
are flashing.After 1 second,
LED1
andLED3
are flashing whileLED2
are on.After 1 second, repeat from step 1.
Keyword: Finite State Machine
LED1 RED
LED2 GREEN
LED3 BLUE
BTN1 RED one
BTN2 GREEN one
Order: BTN2 -> BTN1 -> BTN1 & BTN2
Task 2 :TFT
Print the time elapsed with the format of
mm:ss:sssZ
wheresssZ
means millisecond. e.g.00:23:109
(@2)Print a 50px * 50px square directly under the elapsed time where its color changes when 1 second passed.(@2)
Keywords:
HAL_GetTick
Hints:
Integer division
1 min = 60 second, 1 second = 1000 milliseconds
Read the function prototypes in Core/Inc/lcd/lcd.h for more tft_print functions that you can use.
The actual size of square printed on TFT should be larger than this one
Last updated