For the project in AGH
Dependencies: mbed Servo BSP_DISCO_F413ZH
Diff: main.cpp
- Revision:
- 0:401936269c3e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Jun 27 09:58:29 2022 +0000 @@ -0,0 +1,56 @@ +#include "mbed.h" +#include "Servo.h" +#include "stm32f413h_discovery.h" +#include "stm32f413h_discovery_ts.h" +#include "stm32f413h_discovery_lcd.h" +#include "stdlib.h" + + +DigitalOut myled1(LED1); +DigitalOut myled2(LED2); + +Servo myservo(D9); //PIN D9 + + +int main() +{ + BSP_LCD_Init(); + BSP_LCD_Clear(LCD_COLOR_WHITE); + + int counter=0; + + myled1 = 0; //LED1 is OFF + myled2 = 0; //LED2 is OFF + + + BSP_LCD_SetTextColor(LCD_COLOR_BLACK); + + while(1) { + + + for(counter=0; counter<100; counter++) { + myservo = counter/100.0; + wait(0.01); + myled1 = 1; + myled2 = 0; + BSP_LCD_DisplayStringAt(0, 80, (uint8_t *)"counter-clockwise", CENTER_MODE); + } + BSP_LCD_Clear(LCD_COLOR_WHITE); + for(counter=100; counter>0; counter--) { + myservo = counter/100.0; + wait(0.01); + myled1 = 0; + myled2 = 1; + BSP_LCD_DisplayStringAt(0, 80, (uint8_t *)"clockwise", CENTER_MODE); + } + BSP_LCD_Clear(LCD_COLOR_WHITE); + + + + + + + } +} + +