Shift reg project because tom didn't publish it correctly.
Dependencies: mbed mbed-rtos ShiftReg2 TextLCD
Diff: main.cpp
- Revision:
- 3:5665939d31ca
- Parent:
- 2:4c18a6d89f19
--- a/main.cpp Tue Apr 09 18:45:33 2019 +0000 +++ b/main.cpp Tue May 07 14:05:31 2019 +0000 @@ -8,33 +8,61 @@ 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 +//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); +//DigitalOut Muscle0(PA_10); +//DigitalOut Muscle1(PA_10); -AnalogIn FEEDBACK_0(PB_0); -AnalogIn FEEDBACK_1(PB_1); +//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 - - while(1) { - myled = 1; // LED is ON - Muscle0 = 1; - wait(1); // 200 ms - - - myled = 0; // LED is OFF - Muscle0 = 0; - wait(1); // 1 sec - + //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"); - + //PC.printf("%.6f %.6f\n\r",FEEDBACK_0.read(),FEEDBACK_1.read()); + //LCD.printf("Hello World!\n"); + } }