原创 arduino 7段数码管显示实验

2011-4-4 09:25 2970 12 12 分类: 工程师职场

编译环境: DELL D630 笔记本


实验板:arduino  Duemilanove 改进版控制板 ATmega8(看下面的连接)。



http://blog.ednchina.com/huanan_/1983286/message.aspx


http://item.taobao.com/auction/item_detail.htm?item_num_id=9342078118



 


 


 


 


 


 


 


 


 


 


 


 


编译环境:arduino 0022


编译器截图:


[attachimg]147213[/attachimg]


实验代码如下:


int led_A =0;   //D0 ---- LED 7PIN


int led_B =1;   //D1 ---- LED 6PIN


int led_C =2;   //D2 ---- LED 4PIN


int led_D =3;   //D3 ---- LED 2PIN


int led_E =4;   //D4 ---- LED 1PIN


int led_F =5;   //D5 ---- LED 9PIN


int led_G =6;   //D6 ---- LED 10PIN


 


void display(int a)


{


  switch(a)


  {


    case 0:


    {


      digitalWrite(led_A,LOW);


      digitalWrite(led_B,LOW);


      digitalWrite(led_C,LOW);


      digitalWrite(led_D,LOW);


      digitalWrite(led_E,LOW);


      digitalWrite(led_F,LOW);


    }


    case 1:


    {


       digitalWrite(led_B,LOW);


       digitalWrite(led_C,LOW);


    }


  }


}


void setup()


{


  pinMode(led_A,OUTPUT);


  pinMode(led_B,OUTPUT);


  pinMode(led_C,OUTPUT);


  pinMode(led_D,OUTPUT);


  pinMode(led_E,OUTPUT);


  pinMode(led_F,OUTPUT);


  pinMode(led_G,OUTPUT);


 


  digitalWrite(led_A,HIGH);


  digitalWrite(led_B,HIGH);


  digitalWrite(led_C,HIGH);


  digitalWrite(led_D,HIGH);


  digitalWrite(led_E,HIGH);


  digitalWrite(led_F,HIGH);


  digitalWrite(led_G,HIGH);


 


}


void loop()


{


   digitalWrite(led_A,LOW);


   digitalWrite(led_B,LOW);


   digitalWrite(led_C,LOW);


   digitalWrite(led_D,LOW);


   digitalWrite(led_E,LOW);


   digitalWrite(led_F,LOW);


}


视频连接:


http://v.youku.com/v_show/id_XMjUzNDY2Njg0.html


运行效果图:


[attachimg]147216[/attachimg]



哈尔滨同翔电子


QQ:306136554


http://shop33987716.taobao.com/


http://www.tongxiangdz.com

PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
12
关闭 站长推荐上一条 /3 下一条