编译环境: DELL D630 笔记本
实验板:arduino Duemilanove 改进版控制板。
http://blog.ednchina.com/huanan_/1983286/message.aspx
http://item.taobao.com/auction/item_detail.htm?item_num_id=9342078118
编译环境:arduino 0022
编译器截图:
程序源码:
int EN1 = 9;
int IN1 = 8;
int IN2 = 7;
int EN2 = 6;
int IN3 = 5;
int IN4 = 4;
void setup()
{
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
}
void loop()
{
int value;
for(value = 0 ; value <= 255; value+=5)
{
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);
digitalWrite(IN3,HIGH);
digitalWrite(IN4,LOW);
analogWrite(EN1, value);
analogWrite(EN2, value);
delay(30);
}
}
运行效果图:
文章评论(0条评论)
登录后参与讨论