Craig Evans
/
1620_App_Board_Shift_Register
Shift Register
Diff: main.cpp
- Revision:
- 0:4e3e179f4c8e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Mar 03 15:10:14 2017 +0000 @@ -0,0 +1,33 @@ +/* ELEC1620 Application Board Example + +Shift Register + +(c) Dr Craig A. Evans, University of Leeds, Feb 2017 + +*/ + +#include "mbed.h" +#include "ShiftReg.h" // include ShiftReg library + +ShiftReg shift; // create ShiftReg object + +int main() +{ + // values for 0 - 9 in hex + int seven_seg_array [] = { + 0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x67 + }; + + // write 0 to 7-seg to turn it off + shift.write(0x00); + + while(1) { + + // loop through the array + for(int i = 0; i < 10; i++) { + shift.write(seven_seg_array[i]); + wait(0.5); + } + + } +}