Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed mbed-rtos ShiftReg2 TextLCD
main.cpp
00001 #include "mbed.h" 00002 #include "rtos.h" //Real Time Operating System. https://os.mbed.com/handbook/RTOS 00003 #include "TextLCD.h" 00004 #include "ShiftReg.h" 00005 00006 //Pinouts for the bluepill can be found here 00007 //https://os.mbed.com/users/hudakz/code/STM32F103C8T6_Hello/ 00008 00009 DigitalOut myled(PC_13); //Onboard LED 00010 Serial PC(PB_10, PB_11); //TX, RX 00011 //TextLCD LCD(PB_12, PB_13, PB_14, PB_15, PA_8, PA_9); // rs, e, d4-d7 00012 ShiftReg SR(PA_10, PA_12, PA_15, PA_11); //data, store, clock, output enable 00013 00014 00015 //DigitalOut Muscle0(PA_10); 00016 //DigitalOut Muscle1(PA_10); 00017 00018 //AnalogIn FEEDBACK_0(PB_0); 00019 //AnalogIn FEEDBACK_1(PB_1); 00020 00021 00022 int main() 00023 { 00024 /* 00025 //outen = 0; 00026 SR.ShiftByte(0x0000, ShiftReg::MSBFirst); 00027 //SR.ShiftByte(0x00,0x80); 00028 SR.Latch(); 00029 wait(0.2); 00030 SR.ShiftByte(0xF0F0, ShiftReg::MSBFirst); 00031 SR.Latch(); 00032 //outen = 0; 00033 wait(2); 00034 SR.ShiftByte(0x0000, ShiftReg::MSBFirst); 00035 SR.Latch(); 00036 */ 00037 SR.Write(0x0000); 00038 wait(1); 00039 while(1) 00040 { 00041 SR.Write(0xF0F0); 00042 wait(1); 00043 SR.Write(0x0F0F); 00044 wait(1); 00045 /* 00046 SR.ShiftBit(1); 00047 SR.Latch(); 00048 wait(0.2); 00049 for (int i = 0; i < 16; i++) { 00050 SR.ShiftBit(0); 00051 SR.Latch(); 00052 wait(0.2); 00053 } 00054 */ 00055 //myled = 1; // LED is ON 00056 //Muscle0 = 1; 00057 //wait(1); // 200 ms 00058 00059 //myled = 0; // LED is OFF 00060 //Muscle0 = 0; 00061 //wait(1); // 1 sec 00062 00063 PC.printf("troll lol lol lol lol lol lol\n\r"); 00064 //PC.printf("%.6f %.6f\n\r",FEEDBACK_0.read(),FEEDBACK_1.read()); 00065 //LCD.printf("Hello World!\n"); 00066 00067 } 00068 }
Generated on Fri Nov 4 2022 16:57:02 by
1.7.2