![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
PROJ515-MASTER-No-PWM
Dependencies: mbed mbed-rtos ShiftReg2 TextLCD
Diff: main.cpp
- Revision:
- 2:4c18a6d89f19
- Parent:
- 1:241551e24735
- Child:
- 3:5665939d31ca
--- a/main.cpp Sat Mar 30 13:00:13 2019 +0000 +++ b/main.cpp Tue Apr 09 18:45:33 2019 +0000 @@ -1,26 +1,40 @@ #include "mbed.h" #include "rtos.h" //Real Time Operating System. https://os.mbed.com/handbook/RTOS +#include "TextLCD.h" +#include "ShiftReg.h" -//DigitalOut myled(LED1); -DigitalOut myled(PC_13); -//DigitalOut myled2(LED2); -Thread thread; +//Pinouts for the bluepill can be found here +//https://os.mbed.com/users/hudakz/code/STM32F103C8T6_Hello/ + +DigitalOut myled(PC_13); //Onboard LED +Serial PC(PB_10, PB_11); //TX, RX +TextLCD LCD(PB_12, PB_13, PB_14, PB_15, PA_8, PA_9); // rs, e, d4-d7 +//ShiftReg SR1(PA_12, PA_11, PA_10); //data, store, clock -/* -void led2_thread() { - while(true){ - myled2 = !myled2; - Thread::wait(1000); - } -} -*/ +DigitalOut Muscle0(PA_10); +DigitalOut Muscle1(PA_10); + +AnalogIn FEEDBACK_0(PB_0); +AnalogIn FEEDBACK_1(PB_1); -int main() { - // thread.start(led2_thread); + +int main() +{ + + while(1) { myled = 1; // LED is ON + Muscle0 = 1; wait(1); // 200 ms + + myled = 0; // LED is OFF + Muscle0 = 0; wait(1); // 1 sec + + PC.printf("troll lol lol lol lol lol lol\n\r"); + PC.printf("%.6f %.6f\n\r",FEEDBACK_0.read(),FEEDBACK_1.read()); + LCD.printf("Hello World!\n"); + } }