diff options
| author | sowgro <tpoke.ferrari@gmail.com> | 2025-10-23 15:20:24 -0400 |
|---|---|---|
| committer | sowgro <tpoke.ferrari@gmail.com> | 2025-10-23 15:20:24 -0400 |
| commit | 2a3f7c514b1bf8a0e08c9448fc81410b83de69c5 (patch) | |
| tree | be92720c8a60fd6b5c30d85a0e730a3ef446a375 | |
| parent | 25600daf62432a6637f330b9231c0ff807a8e4d1 (diff) | |
| download | 340-repo-Sowgro-2a3f7c514b1bf8a0e08c9448fc81410b83de69c5.tar.gz 340-repo-Sowgro-2a3f7c514b1bf8a0e08c9448fc81410b83de69c5.tar.bz2 340-repo-Sowgro-2a3f7c514b1bf8a0e08c9448fc81410b83de69c5.zip | |
push activity 9
Diffstat (limited to '')
| -rw-r--r-- | project/Core/Src/Activties/activity9.c | 32 | ||||
| -rw-r--r-- | project/Core/Src/main.c | 3 |
2 files changed, 34 insertions, 1 deletions
diff --git a/project/Core/Src/Activties/activity9.c b/project/Core/Src/Activties/activity9.c new file mode 100644 index 0000000..c9f6569 --- /dev/null +++ b/project/Core/Src/Activties/activity9.c @@ -0,0 +1,32 @@ +/* + * activity9.c + * + * Created on: Oct 23, 2025 + * Author: sowgro + */ + +#include "GPIO.h" +#include <stdint.h> +#include "stm32l4xx.h" +#include "LED.h" +#include <stdio.h> + +// write a function that prints on/off when the blue button is pressed + +void activity9_run() { + GPIO_Init(); + int prev_status = -1; + for (;;) { + int status = !GPIOC->IDR; + if (status != prev_status) { + prev_status = status; + if (status) { + printf("on\r\n"); + LED_On(); + } else { + printf("off\r\n"); + LED_Off(); + } + } + } +} diff --git a/project/Core/Src/main.c b/project/Core/Src/main.c index 94c1aa1..bb18077 100644 --- a/project/Core/Src/main.c +++ b/project/Core/Src/main.c @@ -23,6 +23,7 @@ int main(void){ // application run function printf("\n\n\n\n\n\n\n\n\r"); // run_demo(); - project_run(); +// project_run(); + activity9_run(); } |
