![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Skeleton code. LCD, Serial, Feedback, MOSFETS
Dependencies: mbed mbed-rtos ShiftReg2 TextLCD
main.cpp
- Committer:
- mwthewsey
- Date:
- 2019-05-07
- Revision:
- 3:5665939d31ca
- Parent:
- 2:4c18a6d89f19
- Child:
- 4:020f93d35f6e
File content as of revision 3:5665939d31ca:
#include "mbed.h" #include "rtos.h" //Real Time Operating System. https://os.mbed.com/handbook/RTOS #include "TextLCD.h" #include "ShiftReg.h" //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 SR(PA_10, PA_12, PA_15, PA_11); //data, store, clock, output enable //DigitalOut Muscle0(PA_10); //DigitalOut Muscle1(PA_10); //AnalogIn FEEDBACK_0(PB_0); //AnalogIn FEEDBACK_1(PB_1); int main() { /* //outen = 0; SR.ShiftByte(0x0000, ShiftReg::MSBFirst); //SR.ShiftByte(0x00,0x80); SR.Latch(); wait(0.2); SR.ShiftByte(0xF0F0, ShiftReg::MSBFirst); SR.Latch(); //outen = 0; wait(2); SR.ShiftByte(0x0000, ShiftReg::MSBFirst); SR.Latch(); */ SR.Write(0x0000); wait(1); while(1) { SR.Write(0xF0F0); wait(1); SR.Write(0x0F0F); wait(1); /* SR.ShiftBit(1); SR.Latch(); wait(0.2); for (int i = 0; i < 16; i++) { SR.ShiftBit(0); SR.Latch(); wait(0.2); } */ //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"); } }