查看“数码管控制”的源代码
←
数码管控制
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{| style="width: 800px;" |- | ==Objective== The course will show you how to use Processing to control a common cathode digital tube. ==Equipment== *'''[[Microduino-Core]]''' *'''[[Microduino-FT232R]]''' *Other Hardware Equipment **A USB cable **A common cathode digital tube **A box of jumpers **A resistor of 10K Ω ==Schematic== [[File:processing7SegmentSchematics.jpg|600px|center|thumb]] ==Program== https://github.com/Microduino/Microduino_Tutorials/tree/master/Microduino_Processing/ProcessingSegment ==Debugging== Step 1:Build the hardware environment according to the schematic, just like this: [[File:processing7SegmentConnectionDiagram.jpg|600px|center|thumb]] Step 2: Here is the code needed: The code the two ends(Processing and Microduino) Microduino: Using Firmata's StandardFirmata program. Processing: //Define eight led lights to indicate a digital tube. LED[] leds = new LED[8]; // An array of 8 led objects! //Define Microduino pins of the corresponding digital tube pins (1,2...10). int microduinoPins[] = {//Correspondence microduino pin for 7 segment 11,2,4,5,6,7,9,10}; //Define the name of each segment LED digital tube String segmentLables[]={"1-e","2-d","3-c","4-dp","5-b","6-a","7-f","8-g"}; //Initialize and draw each led in setup(). for (int i = 0; i < leds.length; i ++ ) { // Initialize each led and output pin using a for loop. arduino.pinMode(microduinoPins[i], Arduino.OUTPUT); } leds[0] = new LED(50, 350, 50,200,1); leds[1] = new LED(100, 550, 200,50,2); leds[2] = new LED(300, 350, 50,200,3); leds[3] = new LED(350, 550, 50,50,4); leds[4] = new LED(300, 100, 50,200,5); leds[5] = new LED(100, 50, 200,50,6); leds[6] = new LED(50, 100, 50,200,7); leds[7] = new LED(100, 300, 200,50,8); //Draw the digital tube in draw(), judge the status of the led lights, and send the current status to Microduino for (int i = 0; i < leds.length; i ++ ) { // Run each Car using a for loop. leds[i].display(); //draw segemnt lables text (segmentLables[i], leds[i].xpos, leds[i].ypos); if (leds[i].button) {//switch led on/off arduino.digitalWrite(microduinoPins[i], Arduino.HIGH); } else { arduino.digitalWrite(microduinoPins[i], Arduino.LOW); } } Step 3:Download the code and get it compiled successfully. Step 4:There will appear eight led lights in Processing after the system goes smoothly. Please click each led and see the response of the digital tube. ==Result== Click the mouse and the corresponding digital tube led will turn on or off, as follows: [[File:processing7SegmentResult1.jpg|600px|center|thumb]] ==Video== |}
该页面使用的模板:
模板:Language
(
查看源代码
)
模板:Nmbox
(
查看源代码
)
返回至
数码管控制
。
导航菜单
个人工具
创建账户
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
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
帮助
常见问题
帮助
工具
链入页面
相关更改
特殊页面
页面信息