k j
/
smart_drawer
sads
Fork of smart_drawer by
main.cpp
- Committer:
- Dennis_Yu
- Date:
- 2018-07-20
- Revision:
- 0:ef75cadf684d
- Child:
- 1:4ffc39e81583
File content as of revision 0:ef75cadf684d:
#include "mbed.h" //DigitalOut myled(LED1); //DigitalOut(PB_3); //DIgitalOut(PB_12); //DigitalOut(PA_12); //DigitalOut(PA_11); //DigitalOut(PB_3); DigitalOut red[2]= { PB_3,PB_12, }; DigitalOut black[3]= { PA_12,PA_11,PB_3, }; /*************************************** The SetUp function initial all pins. ****************************************/ int SetUp() { for(int i=0; i<2; i++) { red[i] = 0; } for(int i=0; i<3; i++) { black[i] = 1; } return 0; } /***************************** The Open function open a drawer at Row & Col. 1 <= Row <= 2 1 <= Col <= 3 *****************************/ void Open(int Row, int Col) { SetUp(); red[Row-1] = 1; black[Col-1] = 0; wait(0.1); SetUp(); } int main() { SetUp(); for(int col=1; col<=3; col++) { for(int row=1; row<=2; row++) { Open(row,col); wait(0.5); } } }