Dependencies:
ShiftReg
mbed
main.cpp
- Committer:
- eencae
- Date:
- 2017-03-03
- Revision:
- 0:4e3e179f4c8e
File content as of revision 0:4e3e179f4c8e:
/* 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);
}
}
}