查看“Resistance meter”的源代码
←
Resistance meter
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{| style="width: 800px;" |- | ==Objective== The course will show you how to use Processing to display the graph of the ohmmeter value, and the ohmmeter will be achieved by microduino. ==Equipment== *'''[[Microduino-Core]]''' *'''[[Microduino-FT232R]]''' *Other Hardware Equipment **A USB cable **A 20k Ω resistor **A 104 ceramic capacitor **A bread board **A box of jumpers ==Schematic Diagram== [[File:ResistanceMeterSchematics.jpg|600px|center|thumb]] ==Program== Referring to ResistanceMeter processingResistanceMeter ==Debugging== Step 1:Building hardware environment according to the schematic diagram, just as follows: [[File:IResistanceMeterConnectionDiagram.jpg|600px|center|thumb]] Step 2:Here is the code we need: The code of two ends (Processing and Microduino) Microduino: //Using filter algorithm to calculate resistance and displaying the data on Processing via serial output. //filter Algorithm float filter() { float sum = 0; for(int count = 0; count < N; count++) { sum += r; delay(5); } return (float)(sum / N); } Processing: //After getting the data of the first serial port, you can define or cache the data if there is a new line. // is always my Microduino, so I open Serial.list()[0]. // Open whatever port is the one you're using. myPort = new Serial(this, Serial.list()[0], 9600); myPort.bufferUntil('\n'); // Trigger a SerialEvent on new line //On the screeen, displaying the data received from Microduino in the form of graph and marking scale. String val = myPort.readStringUntil('\n'); if (val != null) { if ("Infinity!!".equals(val)) { unit="resistancetoo big"; } else { if ("K ohm".equals(val)) { unit="K ohm"; } else if (" ohm".equals(val)) { unit=" ohm"; } else { val = trim(val); println(val); resistance=Float.parseFloat(val); } } } vals[vals.length-1] = 200-resistance; //Display scale text ( "200-", 370, 10); text ( "--", 370, 50); text ( "100-", 370, 100); text ( "--", 370, 150); text ( "0-", 370, 200); //show current num text ( resistance+unit, 0, 10); Step 3:Uploading the code and compiling it successfully. Step 4: Putting the resistor ready to measure between the yellow and the black lines on the graph, watching resistance on Processing. ==Result== The graph will display the current resistance. [[File:IResistanceMeterResult.jpg|600px|center|thumb]] ==Video==
返回至
Resistance meter
。
导航菜单
个人工具
创建账户
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
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
帮助
常见问题
帮助
工具
链入页面
相关更改
特殊页面
页面信息