标签:item pga git code comm mbed out sbt pre
#include<mbed.h>
DigitalOut Aout(p5);
DigitalOut Bout(p6);
Serial pc(USBTX,USBRX);
void item1()
{
Aout = 0;
wait(0.01);
Bout = 0;
wait(1.5);
}
void item2()
{
Aout = 0;
wait(0.01);
Bout = 1;
wait(1.5);
}
void item3()
{
Aout = 1;
wait(0.01);
Bout = 0;
wait(1.5);
}
void item4()
{
Aout = 1;
wait(0.01);
Bout = 1;
wait(1.5);
}
char c;
int main()
{
while(1)
{
c = pc.getc();
wait(0.001);
if(c == '1')
{
item1();
item2();
item1();
continue;
}
if(c == '2')
{
item1();
item2();
item3();
item2();
item1();
continue;
}
if(c == '3')
{
item1();
item2();
item3();
item4();
item3();
item2();
item1();
continue;
}
if(c == '4')
{
item1();
item2();
item1();
break;
}
if(c == '5')
{
item1();
continue;
}
if(c == '6')
{
item2();
continue;
}
if(c == '7')
{
item3();
continue;
}
if(c == '8')
{
item4();
continue;
}
}
}
标签:item pga git code comm mbed out sbt pre
原文地址:https://www.cnblogs.com/ronnielee/p/9833159.html