查看“8*8 Single-color Lattice Control”的源代码
←
8*8 Single-color Lattice Control
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{| style="width: 800px;" |- | ==Objective== The course will show you how to use Processing to control 8*8 lattice. ==Equipment== *'''[[Microduino-Core]]''' *'''[[Microduino-FT232R]]''' *Other Hardware Equipment **A USB cable **A box of jumpers **A breadboard **A 8*8 lattice **Two 74HC595 ==Schematic== [[File:88LatticeSchematics.jpg|600px|center|thumb]] ==Program== Referring to ProcessingLattice ==Debugging== Step 1:Build the hardware environment according to the schematic, as follows: [[File:88LatticeConnectionDiagram.jpg|600px|center|thumb]] Step 2:Explain the code: There will be the code of two ends (Processing and Microduino) needed in this course. Microduino: Using firmata’s StandardFirmata program. Processing: //Define the first serial port. arduino = new Arduino(this, Arduino.list()[0], 57600); //Define the output pin in setup() as well as 64 LED objects arduino.pinMode(latchPin, Arduino.OUTPUT); for (int i=0;i<8;i++) { for (int j = 0; j < 8; j ++ ) { // Initialize each led and output pin using a for loop. leds[i][j] = new LED((i+1)*60, (j+1)*60, 50, 50, j+1+(i*10)); ledStates[i][j]=false; } } //Judge on which line or row the open fire of the 64 LED goes on or off. background(255); for (int i=0; i<8;i++) { for (int j = 0; j < 8; j ++ ) { // Run each LED using a for loop. leds[i][j].display(); if (leds[i][j].button) {//switch led on/off ledStates[i][j]=true; } else { ledStates[i][j]=false; } } } //Control and process the 74hc595 chip, map onto the 8*8 lattice. for (int i=0;i<8;i++) { arduino.digitalWrite(latchPin, 0); shiftOut(dataPin, clockPin, maskByteLines[0]); //mask(col) shiftOut(dataPin, clockPin, booleanArray2Byte(ledStates[i])); //row arduino.digitalWrite(latchPin, 1); } Function Reference: mousePressed();//Mouse clicked event processing booleanArray2Byte();//Convert boolean array into byte value shiftOut();//The 74hc595 chip’s shifOut binary handler function Step 3:Get the code downloaded and compiled successfully. Step 4:The 8*8 LED lattice will be displayed in Processing. Click any LED to see what happens. ==Result== The LED lights go on and out correspondingly with the 8*8 lattice, just like this [[File:88LatticeResult.jpg|600px|center|thumb]] ==Video== |}
返回至
8*8 Single-color Lattice Control
。
导航菜单
个人工具
创建账户
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
Welcome
首页
创客大赛
大赛详情
3D打印
安装月球车
图形化编程
操控月球车
升级月球车
编程工具下载
软件下载
Arduino
Processing
Mixly
Scratch
模块套件
Microduino 102
mCookie 102
mCookie 202
mCookie 302
IBC
其他
应用套件
四轴飞行器
平衡车
小车CUBE
音乐播放器
刷卡音乐播放器
wifi气象站
彩虹音乐触摸灯
分贝检测仪
迎门汇报
LED点阵时钟
LED点阵屏幕
硬件
mCookie
Sensor
Microduino
MicroWrt
MicroNux
MicroRobot-Core
MicroRobot-CoreESP
ideaBoard
ideaBox
MicroMV
MicroAI
帮助
常见问题
帮助
工具
链入页面
相关更改
特殊页面
页面信息