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.
ShiftReg.cpp
00001 #include "ShiftReg.h" 00002 00003 ShiftReg::ShiftReg() 00004 { 00005 clkout = new DigitalOut(p7); 00006 dataout = new DigitalOut(p5); 00007 latchout = new DigitalOut(p30); 00008 } 00009 00010 ShiftReg::~ShiftReg() 00011 { 00012 delete clkout; 00013 delete dataout; 00014 delete latchout; 00015 } 00016 00017 void ShiftReg::write(int data) 00018 { 00019 *latchout = 0; 00020 for (int i = 7; i >= 0; i--) { 00021 *clkout = 0; 00022 *dataout = (data & (1 << i)) != 0; 00023 *clkout = 1; 00024 } 00025 *latchout = 1; 00026 }
Generated on Wed Jul 13 2022 12:24:57 by
1.7.2