![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Skeleton code. LCD, Serial, Feedback, MOSFETS
Dependencies: mbed mbed-rtos ShiftReg2 TextLCD
main.cpp@2:4c18a6d89f19, 2019-04-09 (annotated)
- Committer:
- mwthewsey
- Date:
- Tue Apr 09 18:45:33 2019 +0000
- Revision:
- 2:4c18a6d89f19
- Parent:
- 1:241551e24735
- Child:
- 3:5665939d31ca
Basic skeleton code. LCD, Serial, Feedback, mosfets;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mwthewsey | 0:c63c0359492d | 1 | #include "mbed.h" |
mwthewsey | 0:c63c0359492d | 2 | #include "rtos.h" //Real Time Operating System. https://os.mbed.com/handbook/RTOS |
mwthewsey | 2:4c18a6d89f19 | 3 | #include "TextLCD.h" |
mwthewsey | 2:4c18a6d89f19 | 4 | #include "ShiftReg.h" |
mwthewsey | 0:c63c0359492d | 5 | |
mwthewsey | 2:4c18a6d89f19 | 6 | //Pinouts for the bluepill can be found here |
mwthewsey | 2:4c18a6d89f19 | 7 | //https://os.mbed.com/users/hudakz/code/STM32F103C8T6_Hello/ |
mwthewsey | 2:4c18a6d89f19 | 8 | |
mwthewsey | 2:4c18a6d89f19 | 9 | DigitalOut myled(PC_13); //Onboard LED |
mwthewsey | 2:4c18a6d89f19 | 10 | Serial PC(PB_10, PB_11); //TX, RX |
mwthewsey | 2:4c18a6d89f19 | 11 | TextLCD LCD(PB_12, PB_13, PB_14, PB_15, PA_8, PA_9); // rs, e, d4-d7 |
mwthewsey | 2:4c18a6d89f19 | 12 | //ShiftReg SR1(PA_12, PA_11, PA_10); //data, store, clock |
mwthewsey | 0:c63c0359492d | 13 | |
mwthewsey | 2:4c18a6d89f19 | 14 | DigitalOut Muscle0(PA_10); |
mwthewsey | 2:4c18a6d89f19 | 15 | DigitalOut Muscle1(PA_10); |
mwthewsey | 2:4c18a6d89f19 | 16 | |
mwthewsey | 2:4c18a6d89f19 | 17 | AnalogIn FEEDBACK_0(PB_0); |
mwthewsey | 2:4c18a6d89f19 | 18 | AnalogIn FEEDBACK_1(PB_1); |
mwthewsey | 0:c63c0359492d | 19 | |
mwthewsey | 2:4c18a6d89f19 | 20 | |
mwthewsey | 2:4c18a6d89f19 | 21 | int main() |
mwthewsey | 2:4c18a6d89f19 | 22 | { |
mwthewsey | 2:4c18a6d89f19 | 23 | |
mwthewsey | 2:4c18a6d89f19 | 24 | |
mwthewsey | 0:c63c0359492d | 25 | while(1) { |
mwthewsey | 0:c63c0359492d | 26 | myled = 1; // LED is ON |
mwthewsey | 2:4c18a6d89f19 | 27 | Muscle0 = 1; |
mwthewsey | 1:241551e24735 | 28 | wait(1); // 200 ms |
mwthewsey | 2:4c18a6d89f19 | 29 | |
mwthewsey | 2:4c18a6d89f19 | 30 | |
mwthewsey | 0:c63c0359492d | 31 | myled = 0; // LED is OFF |
mwthewsey | 2:4c18a6d89f19 | 32 | Muscle0 = 0; |
mwthewsey | 1:241551e24735 | 33 | wait(1); // 1 sec |
mwthewsey | 2:4c18a6d89f19 | 34 | |
mwthewsey | 2:4c18a6d89f19 | 35 | PC.printf("troll lol lol lol lol lol lol\n\r"); |
mwthewsey | 2:4c18a6d89f19 | 36 | PC.printf("%.6f %.6f\n\r",FEEDBACK_0.read(),FEEDBACK_1.read()); |
mwthewsey | 2:4c18a6d89f19 | 37 | LCD.printf("Hello World!\n"); |
mwthewsey | 2:4c18a6d89f19 | 38 | |
mwthewsey | 0:c63c0359492d | 39 | } |
mwthewsey | 0:c63c0359492d | 40 | } |