极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 13021|回复: 21

Microduino core制作摇摇棒 更新

[复制链接]
发表于 2013-11-2 12:11:26 | 显示全部楼层 |阅读模式
本帖最后由 井底添蛙 于 2016-6-25 01:36 编辑

直接上图,正面

正面

正面

背面

背面

背面

焊接的好丑@老文。

心

图案
更新
打板

板子

板子

QQ Photo20131111001832.jpg
焊接好后

焊接好的正面

焊接好的正面

焊接好的反面

焊接好的反面

本想传视频的,但没拍好手机刷新率太高了
效果图:
QQ Photo20131111002429.jpg
QQ Photo20131111002423.jpg
QQ Photo20131111002436.jpg
QQ Photo20131111002444.jpg
完结
默默附上视频



[pre lang="arduino" line="1" file="yaoyaobang_ceshi"]/*...........design for microduino...via xjj.......*/
/*********************************************************************/
#define crychoose 8  //晶振频率,16mhz=16,8mhz=8,
#define key 0        //是否有按键,有为1,按键切换字模;无为0,自动切换字模。
/*********************************************************************/

boolean on = false;//去重变量
int w=0;//选择显示的字幕变量,从word0[]开始
int a;//变量
int b=0;//
int cry=0;//

static unsigned char word0[]=       //字幕0;按120*24取模,5个24*24汉字,下同
{
  /*******Microduino**********/
  0x20,0x00,0x10,0xE0,0xFF,0x1F,0xE0,0x01,
  0x10,0xE0,0x3F,0x00,0x00,0xFE,0x03,0x00,
  0xC0,0x1F,0x00,0xE0,0x03,0x00,0x1E,0x00,
  0xE0,0x01,0x10,0xE0,0xFF,0x1F,0xE0,0xFF,
  0x1F,0x20,0x00,0x10,//M0
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,
  0x10,0x00,0x04,0x10,0x00,0x04,0x10,0x60,
  0xFC,0x1F,0x60,0xFC,0x1F,0x00,0x00,0x10,
  0x00,0x00,0x10,0x00,0x00,0x10,0x00,0x00,
  0x00,0x00,0x00,0x00,//i1
  0x00,0x00,0x00,0x00,0xE0,0x03,0x00,0xF8,
  0x0F,0x00,0x18,0x0C,0x00,0x04,0x10,0x00,
  0x04,0x10,0x00,0x04,0x10,0x00,0x3C,0x10,
  0x00,0x38,0x08,0x00,0x00,0x06,0x00,0x00,
  0x00,0x00,0x00,0x00,//c2
  0x00,0x04,0x10,0x00,0x04,0x10,0x00,0x04,
  0x10,0x00,0xFC,0x1F,0x00,0xFC,0x1F,0x00,
  0x10,0x10,0x00,0x08,0x10,0x00,0x04,0x10,
  0x00,0x04,0x00,0x00,0x0C,0x00,0x00,0x0C,
  0x00,0x00,0x00,0x00,//r3
  0x00,0x00,0x00,0x00,0xE0,0x03,0x00,0xF0,
  0x0F,0x00,0x18,0x0C,0x00,0x0C,0x10,0x00,
  0x04,0x10,0x00,0x04,0x10,0x00,0x0C,0x10,
  0x00,0x18,0x0C,0x00,0xF0,0x0F,0x00,0xE0,
  0x03,0x00,0x00,0x00,//o4
  0x00,0x00,0x00,0x00,0xE0,0x03,0x00,0xF8,
  0x0F,0x00,0x1C,0x18,0x00,0x04,0x10,0x00,
  0x04,0x10,0x00,0x04,0x10,0x20,0x08,0x08,
  0xE0,0xFF,0x1F,0xF0,0xFF,0x0F,0x00,0x00,
  0x08,0x00,0x00,0x00,//d5
  0x00,0x00,0x00,0x00,0x04,0x00,0x00,0xFC,
  0x0F,0x00,0xFE,0x1F,0x00,0x00,0x18,0x00,
  0x00,0x10,0x00,0x00,0x10,0x00,0x04,0x08,
  0x00,0xFC,0x1F,0x00,0xFE,0x0F,0x00,0x00,
  0x08,0x00,0x00,0x00,//u6
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,
  0x10,0x00,0x04,0x10,0x00,0x04,0x10,0x60,
  0xFC,0x1F,0x60,0xFC,0x1F,0x00,0x00,0x10,
  0x00,0x00,0x10,0x00,0x00,0x10,0x00,0x00,
  0x00,0x00,0x00,0x00,//i7
  0x00,0x00,0x00,0x00,0x04,0x10,0x00,0xFC,
  0x1F,0x00,0xFC,0x1F,0x00,0x08,0x10,0x00,
  0x08,0x00,0x00,0x04,0x00,0x00,0x04,0x10,
  0x00,0xFC,0x1F,0x00,0xF8,0x1F,0x00,0x00,
  0x10,0x00,0x00,0x00,//n8
  0x00,0x00,0x00,0x00,0xE0,0x03,0x00,0xF0,
  0x0F,0x00,0x18,0x0C,0x00,0x0C,0x10,0x00,
  0x04,0x10,0x00,0x04,0x10,0x00,0x0C,0x10,
  0x00,0x18,0x0C,0x00,0xF0,0x0F,0x00,0xE0,
  0x03,0x00,0x00,0x00,//o9
};
const char word1[]=
{
  /*******Microduino**********/
  0x20,0x00,0x10,0xE0,0xFF,0x1F,0xE0,0x01,
  0x10,0xE0,0x3F,0x00,0x00,0xFE,0x03,0x00,
  0xC0,0x1F,0x00,0xE0,0x03,0x00,0x1E,0x00,
  0xE0,0x01,0x10,0xE0,0xFF,0x1F,0xE0,0xFF,
  0x1F,0x20,0x00,0x10,//M0
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,
  0x10,0x00,0x04,0x10,0x00,0x04,0x10,0x60,
  0xFC,0x1F,0x60,0xFC,0x1F,0x00,0x00,0x10,
  0x00,0x00,0x10,0x00,0x00,0x10,0x00,0x00,
  0x00,0x00,0x00,0x00,//i1
  0x00,0x00,0x00,0x00,0xE0,0x03,0x00,0xF8,
  0x0F,0x00,0x18,0x0C,0x00,0x04,0x10,0x00,
  0x04,0x10,0x00,0x04,0x10,0x00,0x3C,0x10,
  0x00,0x38,0x08,0x00,0x00,0x06,0x00,0x00,
  0x00,0x00,0x00,0x00,//c2
  0x00,0x04,0x10,0x00,0x04,0x10,0x00,0x04,
  0x10,0x00,0xFC,0x1F,0x00,0xFC,0x1F,0x00,
  0x10,0x10,0x00,0x08,0x10,0x00,0x04,0x10,
  0x00,0x04,0x00,0x00,0x0C,0x00,0x00,0x0C,
  0x00,0x00,0x00,0x00,//r3
  0x00,0x00,0x00,0x00,0xE0,0x03,0x00,0xF0,
  0x0F,0x00,0x18,0x0C,0x00,0x0C,0x10,0x00,
  0x04,0x10,0x00,0x04,0x10,0x00,0x0C,0x10,
  0x00,0x18,0x0C,0x00,0xF0,0x0F,0x00,0xE0,
  0x03,0x00,0x00,0x00,//o4
  0x00,0x00,0x00,0x00,0xE0,0x03,0x00,0xF8,
  0x0F,0x00,0x1C,0x18,0x00,0x04,0x10,0x00,
  0x04,0x10,0x00,0x04,0x10,0x20,0x08,0x08,
  0xE0,0xFF,0x1F,0xF0,0xFF,0x0F,0x00,0x00,
  0x08,0x00,0x00,0x00,//d5
  0x00,0x00,0x00,0x00,0x04,0x00,0x00,0xFC,
  0x0F,0x00,0xFE,0x1F,0x00,0x00,0x18,0x00,
  0x00,0x10,0x00,0x00,0x10,0x00,0x04,0x08,
  0x00,0xFC,0x1F,0x00,0xFE,0x0F,0x00,0x00,
  0x08,0x00,0x00,0x00,//u6
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,
  0x10,0x00,0x04,0x10,0x00,0x04,0x10,0x60,
  0xFC,0x1F,0x60,0xFC,0x1F,0x00,0x00,0x10,
  0x00,0x00,0x10,0x00,0x00,0x10,0x00,0x00,
  0x00,0x00,0x00,0x00,//i7
  0x00,0x00,0x00,0x00,0x04,0x10,0x00,0xFC,
  0x1F,0x00,0xFC,0x1F,0x00,0x08,0x10,0x00,
  0x08,0x00,0x00,0x04,0x00,0x00,0x04,0x10,
  0x00,0xFC,0x1F,0x00,0xF8,0x1F,0x00,0x00,
  0x10,0x00,0x00,0x00,//n8
  0x00,0x00,0x00,0x00,0xE0,0x03,0x00,0xF0,
  0x0F,0x00,0x18,0x0C,0x00,0x0C,0x10,0x00,
  0x04,0x10,0x00,0x04,0x10,0x00,0x0C,0x10,
  0x00,0x18,0x0C,0x00,0xF0,0x0F,0x00,0xE0,
  0x03,0x00,0x00,0x00,//o9
};
const char word2[]=
{
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x07,0x00,0xE0,0x07,0x00,
  0xE0,0x07,0x00,0xE0,0x07,0x00,0xE0,0x07,
  0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
  0xFF,0x07,0x00,0xE0,0x07,0x00,0xE0,0x07,
  0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0xE0,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,
  0x00,0x00,0xF8,0x07,0x00,0xFC,0x3F,0x00,
  0xFE,0xFF,0x00,0xFF,0xFF,0x01,0xFF,0xFF,
  0x03,0xFF,0xFF,0x07,0xFF,0xFF,0x0F,0xFF,
  0xFF,0x1F,0xFE,0xFF,0x1F,0xFC,0xFF,0x3F,
  0xFC,0xFF,0x7F,0xF8,0xFF,0xFF,0xF0,0xFF,
  0xFF,0xF0,0xFF,0xFF,0xF0,0xFF,0xFF,0xF8,
  0xFF,0xFF,0xFC,0xFF,0x7F,0xFC,0xFF,0x3F,
  0xFE,0xFF,0x1F,0xFF,0xFF,0x1F,0xFF,0xFF,
  0x0F,0xFF,0xFF,0x07,0xFF,0xFF,0x03,0xFF,
  0xFF,0x01,0xFE,0xFF,0x00,0xFC,0x3F,0x00,
  0xF8,0x07,0x00,0xF0,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,
  0x07,0x00,0x00,0xFF,0xFF,0x07,0xFF,0xFF,
  0x0F,0xFF,0xFF,0x1F,0xFF,0xFF,0x3F,0xFF,
  0xFF,0x3F,0x07,0x00,0x7E,0x07,0x00,0x7C,
  0x00,0x00,0xF8,0x00,0x00,0xF0,0x00,0x00,
  0xF0,0x00,0x00,0xE0,0x00,0x00,0xE0,0x00,
  0x00,0xF0,0x00,0x00,0xF0,0x00,0x00,0xF8,
  0x07,0x00,0x7C,0x07,0x00,0x7E,0xFF,0xFF,
  0x3F,0xFF,0xFF,0x3F,0xFF,0xFF,0x1F,0xFF,
  0xFF,0x0F,0xFF,0xFF,0x07,0x07,0x00,0x00,
  0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
const char word3[]=
{
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,
  0x00,0x40,0x41,0x00,0x30,0x21,0x00,0x1E,
  0x11,0x00,0x10,0x0D,0x00,0xD0,0xC7,0x7F,
  0xF0,0x43,0x24,0x10,0x45,0x24,0x10,0x4D,
  0x24,0x98,0x59,0x24,0x90,0x51,0x24,0x00,
  0x41,0x24,0xF8,0x5F,0x24,0x10,0x44,0x24,
  0x10,0x44,0x24,0x10,0xC4,0x7F,0x10,0x44,
  0x60,0x10,0x04,0x00,0xF8,0x0F,0x00,0x10,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//智0
  0x00,0x00,0x00,0x00,0x04,0x20,0x40,0x04,
  0x1F,0x40,0xE4,0x03,0x40,0x04,0x04,0xFC,
  0x07,0x08,0x44,0xFC,0x1F,0x40,0x84,0x10,
  0x60,0x44,0x20,0x50,0x46,0x22,0x10,0x08,
  0x22,0xF0,0xFF,0x23,0x10,0x11,0x61,0x10,
  0x11,0x61,0xF0,0xFF,0x7F,0xF0,0xFF,0x6F,
  0x58,0x80,0x64,0x50,0x86,0x63,0x40,0x88,
  0x60,0x40,0x70,0x60,0x40,0xFF,0x60,0xC0,
  0x81,0x63,0x40,0x00,0x20,0x00,0x00,0x00,//趣1
  0x00,0x00,0x00,0x00,0x40,0x00,0x80,0x60,
  0x20,0x80,0x20,0x20,0x80,0x30,0x60,0xFC,
  0xFF,0x3F,0x84,0x08,0x00,0x40,0x04,0x00,
  0x40,0xA0,0x00,0xA0,0x90,0x3F,0x50,0x88,
  0x3E,0x90,0x8F,0x20,0x10,0x88,0x20,0x30,
  0x88,0x20,0x50,0xF8,0x3F,0x88,0xF9,0x3F,
  0x08,0x88,0x20,0x08,0x8A,0x20,0x8C,0x89,
  0x20,0x7C,0x8C,0x7E,0x28,0xC8,0x3E,0x00,
  0xC0,0x00,0x00,0x80,0x00,0x00,0x00,0x00,//摇2
  0x00,0x00,0x00,0x00,0x40,0x00,0x80,0x60,
  0x20,0x80,0x20,0x20,0x80,0x30,0x60,0xFC,
  0xFF,0x3F,0x84,0x08,0x00,0x40,0x04,0x00,
  0x40,0xA0,0x00,0xA0,0x90,0x3F,0x50,0x88,
  0x3E,0x90,0x8F,0x20,0x10,0x88,0x20,0x30,
  0x88,0x20,0x50,0xF8,0x3F,0x88,0xF9,0x3F,
  0x08,0x88,0x20,0x08,0x8A,0x20,0x8C,0x89,
  0x20,0x7C,0x8C,0x7E,0x28,0xC8,0x3E,0x00,
  0xC0,0x00,0x00,0x80,0x00,0x00,0x00,0x00,//摇3
  0x00,0x00,0x00,0x80,0x00,0x02,0x80,0x80,
  0x01,0x80,0x60,0x00,0x80,0x1C,0x00,0xFC,
  0xFF,0x7F,0x84,0x04,0x00,0x80,0x18,0x02,
  0x80,0x34,0x01,0x90,0x84,0x04,0x90,0x64,
  0x04,0x90,0xB4,0x04,0x90,0x8E,0x04,0xF0,
  0x87,0x04,0xBE,0xF4,0x7F,0x90,0x84,0x04,
  0x90,0x8C,0x04,0x90,0xD4,0x04,0x90,0xA4,
  0x04,0x90,0x44,0x04,0x10,0xC4,0x00,0x00,
  0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//棒4
};
const char word4[]=
{
  0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x82,
  0x01,0x10,0x82,0x00,0x10,0x82,0x20,0x10,
  0xC2,0x20,0x10,0x42,0x60,0xF8,0xFF,0x3F,
  0x08,0x22,0x20,0x08,0x22,0x10,0x0C,0x22,
  0x10,0x08,0x22,0x08,0x00,0x02,0x0C,0xFC,
  0x1F,0x04,0x04,0xFE,0x03,0x00,0x02,0x07,
  0x00,0xC2,0x0C,0x08,0x62,0x18,0x30,0x3A,
  0x30,0x70,0x09,0x30,0x80,0x01,0x60,0x00,
  0x01,0x7C,0x00,0x00,0x40,0x00,0x00,0x00,//我0
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,
  0x40,0x00,0x17,0x20,0x00,0x12,0x20,0x10,
  0x12,0x10,0x10,0x12,0x48,0xE8,0x12,0x46,
  0xC8,0x92,0x43,0x08,0xFA,0x20,0x08,0x9E,
  0x21,0x18,0x96,0x22,0xE8,0x92,0x14,0x48,
  0x92,0x08,0x08,0x92,0x1C,0x08,0x92,0x16,
  0xC4,0x92,0x33,0x7C,0xD2,0x21,0x14,0x9A,
  0x20,0x06,0x16,0x60,0x04,0x03,0x60,0x00,
  0x01,0x20,0x00,0x00,0x20,0x00,0x00,0x00,//爱1
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x02,0x00,0x00,0x02,0x00,0x00,0x02,0xC0,
  0x7F,0x02,0x40,0x44,0x02,0x44,0x44,0x02,
  0x4C,0x44,0x02,0x78,0x44,0x02,0x40,0x44,
  0x02,0xC0,0xFF,0x7F,0x40,0x44,0x02,0x60,
  0x44,0x02,0x50,0x44,0x02,0x4E,0x44,0x02,
  0x44,0x44,0x02,0x40,0x44,0x02,0xC0,0x7F,
  0x02,0x40,0x00,0x02,0x00,0x00,0x03,0x00,
  0x00,0x03,0x00,0x00,0x02,0x00,0x00,0x00,//单2
  0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,
  0x20,0x00,0x00,0x10,0x00,0x00,0x0C,0x00,
  0x00,0x07,0xF8,0xFF,0x01,0x08,0x22,0x00,
  0x00,0x22,0x00,0x00,0x22,0x00,0x00,0x22,
  0x00,0x00,0x22,0x00,0x00,0x22,0x00,0x00,
  0x22,0x00,0xFC,0x21,0x00,0x04,0xE2,0x7F,
  0x00,0xE2,0x7F,0x00,0x02,0x00,0x00,0x02,
  0x00,0x00,0x01,0x00,0x80,0x01,0x00,0x00,
  0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//片3
  0x00,0x00,0x00,0x80,0x00,0x02,0x80,0x00,
  0x01,0x80,0xE0,0x00,0x80,0x3C,0x00,0xFE,
  0xFF,0x7F,0x84,0x04,0x70,0x80,0x08,0x40,
  0x80,0x18,0x20,0x80,0x30,0x10,0x00,0x00,
  0x0C,0xF8,0xFF,0x07,0xF0,0x7F,0x00,0x10,
  0x00,0x00,0x10,0x00,0x00,0x10,0x00,0x00,
  0x10,0x00,0x00,0xF8,0xFF,0x3F,0x18,0x00,
  0x30,0x00,0x00,0x20,0x00,0x00,0x20,0x00,
  0x00,0x3E,0x00,0x00,0x30,0x00,0x00,0x00,//机4
};


void setup()
{   
  for(a=4;a<14;a++)  
  {
    pinMode(a, OUTPUT);  
  }  
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
  pinMode(A3, OUTPUT);
  pinMode(2,INPUT_PULLUP);    //中断0内部上拉

  if(crychoose==8)cry=2;//
  else if(crychoose==16)cry=4;//
  
  openflash();                 //开机动画
  //attachInterrupt(1,time,CHANGE);
  attachInterrupt(1,time,RISING);  //中断1,检测位置
  //attachInterrupt(1,time,FALLING);
  attachInterrupt(0,wordnext,FALLING);//中断0,切换字幕

  digitalWrite(11,0);//上8个led共阴通断开关,0为断开,1为开
  digitalWrite(12,0);//中8个led共阴通断开关,0为断开,1为开
  digitalWrite(13,0);//下8个led共阴通断开关,0为断开,1为开

}


void time()  //位置检测中断
{
  on=!on;    //去重

  if(on==true)
  {
    if(key==0)//无按键启动自动切换
    {
      b++;                //无按键时选择,自动切换字幕
      if(b==6)
      {
        wordnext();
        b=0;
      }
    }
    for(int j=0;j<50;j++)  //补偿位置中断靠边,显示不完全问题
    {
      leddisplay(0x00,0x00,0x00);
    }
    displaychoose();
  }
}

void loop()
{
  if((millis()-sleepti)>5000)sleeptime();
  clear();       //清除数据,全灭
}
void wordnext()  //字幕切换
{
  w++;
  if(w==5)w=1;
}
void displaychoose() //字幕选择
{
  switch (w)         //字幕选择
  {
  case 0:
    {
      for(a=0;a<120;a++)
      {
        leddisplay(word0[3*a],word0[3*a+1],word0[3*a+2]);
      }  
    }
    break;
  case 1:
    {
      for(a=0;a<120;a++)
      {
        leddisplay(word1[3*a],word1[3*a+1],word1[3*a+2]);
      }  
    }
    break;
  case 2:
    {
      for(a=0;a<120;a++)
      {
        leddisplay(word2[3*a],word2[3*a+1],word2[3*a+2]);
      }  
    }
    break;
  case 3:
    {
      for(a=0;a<120;a++)
      {
        leddisplay(word3[3*a],word3[3*a+1],word3[3*a+2]);
      }  
    }
    break;
  case 4:
    {
      for(a=0;a<120;a++)
      {
        leddisplay(word4[3*a],word4[3*a+1],word4[3*a+2]);
      }  
    }
    break;
  default:;
  }
}

void clear()//清除
{
  digitalWrite(11,0);
  digitalWrite(12,0);
  digitalWrite(13,0);
  digitalWrite(7,0);
  digitalWrite(8,0);
  digitalWrite(9,0);
  digitalWrite(10,0);
  digitalWrite(5,0);
  digitalWrite(4,0);
  digitalWrite(A3,0);
  digitalWrite(A2,0);
}
void leddisplay(int num1,int num2,int num3)  //数据显示
{
  for(int z=0;z<cry;z++)
  {
    digitalWrite(7, ((num1>>0)&0x01));
    digitalWrite(8, ((num1>>1)&0x01));
    digitalWrite(9, ((num1>>2)&0x01));
    digitalWrite(10,((num1>>3)&0x01));
    digitalWrite(5, ((num1>>4)&0x01));
    digitalWrite(4, ((num1>>5)&0x01));
    digitalWrite(A3,((num1>>6)&0x01));
    digitalWrite(A2,((num1>>7)&0x01));
    digitalWrite(11,1);
    delayMicroseconds(10);
    digitalWrite(11,0);                       //上8个led数据显示

    digitalWrite(7, ((num2>>0)&0x01));
    digitalWrite(8, ((num2>>1)&0x01));
    digitalWrite(9, ((num2>>2)&0x01));
    digitalWrite(10,((num2>>3)&0x01));
    digitalWrite(5, ((num2>>4)&0x01));
    digitalWrite(4, ((num2>>5)&0x01));
    digitalWrite(A3,((num2>>6)&0x01));
    digitalWrite(A2,((num2>>7)&0x01));
    digitalWrite(12,1);
    delayMicroseconds(10);
    digitalWrite(12,0);                       //中8个led数据显示

    digitalWrite(7, ((num3>>0)&0x01));
    digitalWrite(8, ((num3>>1)&0x01));
    digitalWrite(9, ((num3>>2)&0x01));
    digitalWrite(10,((num3>>3)&0x01));
    digitalWrite(5, ((num3>>4)&0x01));
    digitalWrite(4, ((num3>>5)&0x01));
    digitalWrite(A3,((num3>>6)&0x01));
    digitalWrite(A2,((num3>>7)&0x01));
    digitalWrite(13,1);
    delayMicroseconds(10);
    digitalWrite(13,0);                       //下8个led数据显示
  }
}
void openflash()//开机动画
{
  digitalWrite(11,1);
  digitalWrite(12,0);
  digitalWrite(13,0);
  digitalWrite(7,1);
  delay(60);
  digitalWrite(7,0);
  digitalWrite(8,1);
  delay(60);
  digitalWrite(8,0);
  digitalWrite(9,1);
  delay(60);
  digitalWrite(9,0);
  digitalWrite(10,1);
  delay(60);
  digitalWrite(10,0);
  digitalWrite(5,1);
  delay(60);
  digitalWrite(5,0);
  digitalWrite(4,1);
  delay(60);
  digitalWrite(4,0);
  digitalWrite(A3,1);
  delay(60);
  digitalWrite(A3,0);
  digitalWrite(A2,1);
  delay(60);
  digitalWrite(A2,0);

  digitalWrite(11,0);
  digitalWrite(12,1);
  digitalWrite(13,0);
  digitalWrite(7,1);
  delay(60);
  digitalWrite(7,0);
  digitalWrite(8,1);
  delay(60);
  digitalWrite(8,0);
  digitalWrite(9,1);
  delay(60);
  digitalWrite(9,0);
  digitalWrite(10,1);
  delay(60);
  digitalWrite(10,0);
  digitalWrite(5,1);
  delay(60);
  digitalWrite(5,0);
  digitalWrite(4,1);
  delay(60);
  digitalWrite(4,0);
  digitalWrite(A3,1);
  delay(60);
  digitalWrite(A3,0);
  digitalWrite(A2,1);
  delay(60);
  digitalWrite(A2,0);

  digitalWrite(11,0);
  digitalWrite(12,0);
  digitalWrite(13,1);
  digitalWrite(7,1);
  delay(60);
  digitalWrite(7,0);
  digitalWrite(8,1);
  delay(60);
  digitalWrite(8,0);
  digitalWrite(9,1);
  delay(60);
  digitalWrite(9,0);
  digitalWrite(10,1);
  delay(60);
  digitalWrite(10,0);
  digitalWrite(5,1);
  delay(60);
  digitalWrite(5,0);
  digitalWrite(4,1);
  delay(60);
  digitalWrite(4,0);
  digitalWrite(A3,1);
  delay(60);
  digitalWrite(A3,0);
  digitalWrite(A2,1);
  delay(60);
  digitalWrite(A2,0);


  digitalWrite(A2,1);
  delay(60);
  digitalWrite(A2,0);
  digitalWrite(A3,1);
  delay(60);
  digitalWrite(A3,0);
  digitalWrite(4,1);
  delay(60);
  digitalWrite(4,0);
  digitalWrite(5,1);
  delay(60);
  digitalWrite(5,0);
  digitalWrite(10,1);
  delay(60);
  digitalWrite(10,0);
  digitalWrite(9,1);
  delay(60);
  digitalWrite(9,0);
  digitalWrite(8,1);
  delay(60);
  digitalWrite(8,0);
  digitalWrite(7,1);
  delay(60);
  digitalWrite(7,0);

  digitalWrite(11,0);
  digitalWrite(12,1);
  digitalWrite(13,0);
  digitalWrite(A2,1);
  delay(60);
  digitalWrite(A2,0);
  digitalWrite(A3,1);
  delay(60);
  digitalWrite(A3,0);
  digitalWrite(4,1);
  delay(60);
  digitalWrite(4,0);
  digitalWrite(5,1);
  delay(60);
  digitalWrite(5,0);
  digitalWrite(10,1);
  delay(60);
  digitalWrite(10,0);
  digitalWrite(9,1);
  delay(60);
  digitalWrite(9,0);
  digitalWrite(8,1);
  delay(60);
  digitalWrite(8,0);
  digitalWrite(7,1);
  delay(60);
  digitalWrite(7,0);

  digitalWrite(11,1);
  digitalWrite(12,0);
  digitalWrite(13,0);
  digitalWrite(A2,1);
  delay(60);
  digitalWrite(A2,0);
  digitalWrite(A3,1);
  delay(60);
  digitalWrite(A3,0);
  digitalWrite(4,1);
  delay(60);
  digitalWrite(4,0);
  digitalWrite(5,1);
  delay(60);
  digitalWrite(5,0);
  digitalWrite(10,1);
  delay(60);
  digitalWrite(10,0);
  digitalWrite(9,1);
  delay(60);
  digitalWrite(9,0);
  digitalWrite(8,1);
  delay(60);
  digitalWrite(8,0);
  digitalWrite(7,1);
  delay(60);
  digitalWrite(7,0);
  digitalWrite(11,0);
  digitalWrite(12,0);
  digitalWrite(13,0);
}
[/code]

井底添蛙个人主页:www.smilefrog.net

评分

参与人数 1 +3 收起 理由
Microduino + 3 赞一个!

查看全部评分

回复

使用道具 举报

发表于 2013-11-8 00:48:39 | 显示全部楼层
加油啊 等新版
回复 支持 反对

使用道具 举报

发表于 2013-11-8 20:15:48 | 显示全部楼层
坐等板子到来!
回复 支持 反对

使用道具 举报

发表于 2013-11-10 12:50:28 | 显示全部楼层
我也在做,但我搞不懂IO接口与LED该如何对应。
制作暂停了。

能公布下,你的IO与LED如何对应的吗?
回复 支持 反对

使用道具 举报

发表于 2013-11-10 21:38:56 | 显示全部楼层
tom 发表于 2013-11-10 12:50
我也在做,但我搞不懂IO接口与LED该如何对应。
制作暂停了。

Io口可以随意定义,但是程序编写的时候得根据硬件的IO口定义来写!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-11-10 22:46:39 | 显示全部楼层
huang1234 发表于 2013-11-10 21:38
Io口可以随意定义,但是程序编写的时候得根据硬件的IO口定义来写!

是的,随机定义,关键看程序
回复 支持 反对

使用道具 举报

发表于 2013-11-16 19:25:07 | 显示全部楼层
发表一下源代码吧。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-11-17 22:39:02 | 显示全部楼层
tom 发表于 2013-11-16 19:25
发表一下源代码吧。

已发测试代码,有点乱,
回复 支持 反对

使用道具 举报

发表于 2013-11-18 00:36:40 | 显示全部楼层
没接触过这玩意,挺有趣,怎么保证晃动不同频率时的显示正确呢?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-11-19 15:35:47 | 显示全部楼层
chaqing 发表于 2013-11-18 00:36
没接触过这玩意,挺有趣,怎么保证晃动不同频率时的显示正确呢?

计算没次中断的时间,通过计算算出每个位置的延时时间
回复 支持 反对

使用道具 举报

发表于 2014-8-8 22:42:03 | 显示全部楼层
批量生产了?
回复 支持 反对

使用道具 举报

发表于 2014-9-6 23:15:19 | 显示全部楼层
欣赏一下程序
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-9-16 20:53:23 | 显示全部楼层
topdog 发表于 2014-8-8 22:42
批量生产了?

没有,                  
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-9-16 20:53:50 | 显示全部楼层
topdog 发表于 2014-9-6 23:15
欣赏一下程序

吼吼,编程不太会         
回复 支持 反对

使用道具 举报

发表于 2015-3-23 19:17:25 | 显示全部楼层
我爱回帖,赞楼主!!!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊 ( 浙ICP备09023225号 )

GMT+8, 2020-9-29 00:48 , Processed in 0.055630 second(s), 28 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表