VITECH微型步進電機51c代碼
#include
sbit s1=P1^0;
sbit s2=P1^1;
sbit speedadd=P1^6;//加速
sbit speeddel=P1^7; //減速
void delay(int k)
{
while(k--);
}
void main()
{
int k=20000;
while(1)
{
if(!speedadd){k=k-2000;}
s1=0;
delay(k);
s2=0;
delay(k);
s1=1;
delay(k);
s2=1;
delay(k);
if(!speeddel){k=k+2000;}
}
}
總共4個線,2個adclass=0&app_id=0&c=news&cf=1001&ch=0&di=128&fv=17&is_app=0&jk=2a7c1d14e164388e&k=%CF%DF%C8%A6&k0=%CF%DF%C8%A6&kdi0=0&luki=2&n=10&p=baidu&q=98059059_cpr&rb=0&rs=1&seller_id=1&sid=8e3864e1141d7c2a&ssp2=1&stid=0&t=tpclicked3_hc&tu=u1831118&u=http%3A%2F%2Fwww%2E51hei%2Ecom%2Fmcu%2F2181%2Ehtml&urlid=0" id="2_nwl" mpid="2" target="_blank">線圈的一頭公共接5 v,另外2根為單片機驅(qū)動口,驅(qū)動芯片用ULN2003a
這個是步進電機的圖片.
評論