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.
Dependencies: mbed
main.cpp
- Committer:
- kantapon501
- Date:
- 2015-10-20
- Revision:
- 0:408ece0a3217
- Child:
- 1:0422677b0ccc
File content as of revision 0:408ece0a3217:
#include "mbed.h"
DigitalOut Out1(D13);
DigitalOut Out2(D12);
DigitalOut Out3(D11);
DigitalOut Out4(D10);
DigitalOut Out5(D9);
DigitalOut Out6(D8);
DigitalOut Out7(D7);
DigitalOut Out8(D6);
DigitalIn In1(D0);
Serial pc(SERIAL_TX, SERIAL_RX);
int main()
{
int Menu_0 = 0;
int Menu_1 = 0;
int Menu_2 = 0;
int select_0 = 0;
int select_1 = 0;
int select_2 = 0;
int min = 2.5;
pc.printf("Hello sir \n");
while(1)
{
if(Menu_0 == 0)
{
pc.printf("Select Menu \n");
pc.printf("Input 1 for Menu1 \n");
pc.printf("Input 2 for Menu2 \n");
Menu_0 = 1;
}
if(pc.readable())
{
select_0 = pc.getc();
while(1)
{
if(select_0 == 1)
{
if(Menu_1 == 0)
{
pc.printf("Select pattern \n");
pc.printf("Input 1 for pattern1 \n");
pc.printf("Input 2 for pattern2 \n");
pc.printf("Input 3 for Exit!!\n");
Menu_1 = 1;
}
if(pc.readable())
{
select_1 = pc.getc();
if(select_1 == 1)
{
Out1 = 1;
Out8 = 1;
wait_ms(min);
Out1 = 0;
Out8 = 0;
wait_ms(min);
Out2 = 1;
Out7 = 1;
wait_ms(min);
Out2 = 0;
Out7 = 0;
wait_ms(min);
Out3 = 1;
Out6 = 1;
wait_ms(min);
Out3 = 0;
Out6 = 0;
wait_ms(min);
Out4 = 1;
Out5 = 1;
wait_ms(min);
Out4 = 0;
Out5 = 0;
wait_ms(min);
Out3 = 1;
Out6 = 1;
wait_ms(min);
Out3 = 0;
Out6 = 0;
wait_ms(min);
Out2 = 1;
Out7 = 1;
wait_ms(min);
Out2 = 0;
Out7 = 0;
wait_ms(min);
Out1 = 1;
Out8 = 1;
wait_ms(min);
Out1 = 0;
Out8 = 0;
wait_ms(min);
Menu_1 = 0;
}
else if(select_1 == 2)
{
Out1 = 1;
Out2 = 1;
Out3 = 1;
Out4 = 1;
Out5 = 1;
Out6 = 1;
Out7 = 1;
Out8 = 1;
wait_ms(min);
Out1 = 0;
Out2 = 0;
Out3 = 0;
Out4 = 0;
Out5 = 0;
Out6 = 0;
Out7 = 0;
Out8 = 0;
wait_ms(min);
Menu_1 = 0;
}
else if(select_1 ==3)
{
Menu_0 = 0;
Menu_1 = 0;
break;
}
}
}
if(select_0 == 2)
{
if(Menu_2 == 0)
{
pc.printf("Read Switch\n");
pc.printf("Input 3 for Exit!!");
Menu_2 = 1;
}
if(pc.readable())
{
select_2 = pc.getc();
if(select_2 == 3)
{
Menu_2 = 0;
Menu_0 = 0;
break;
}
else
{
if(In1 == 1){pc.printf("1");}
else if(In1 == 0){pc.printf("0");}
}
}
}
}
}
}
}