查看“指南针”的源代码
←
指南针
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{| style="width: 800px;" |- | ==Objective== The course will show you how to simulate a compass in Processing by presenting the data of magnetic field strength detected by Microduino-10DOF module. ==Equipments== *'''[[Microduino-Core]]''' *'''[[Microduino-FT232R]]''' *'''[[Microduino-10DOF]]''' *Other Hardware Equipments **A USB cable ==Schematic Diagram== The HMC5883L magnetic field strength sensor of Microduino-10DOF will be available. ==Program== Referring to compassMicroduino compass_simulator ==Debugging== Step 1:Building the hardware environment according to the schematic diagram, just like this: [[File:compass_simulatorConnectionDiagram.jpg|600px|center|thumb]] Step 2:Here is the code we need: The code of the two ends (Processing and Microduino) Microduino: //The data of the magnetic field strength will be exported into the serial port to be displayed on Processing void loop() { mag.getHeading(&mx, &my, &mz); Serial.print(mx); Serial.print(","); Serial.println(my); } Processing: //After getting the data of the first serial port, defining them or caching them if there is a new line // is always my Arduino, 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 //Presenting the data obtained from Microduino on the screen in the form of curves with different color and then marking them Function Description: //Drawing a magnetic field pointer arrow(int x1, int y1, int x2, int y2, color c) //Judging whether can convert them into numbers isNumeric(String str) Step 3:Uploading the code and compiling them successfully. Step 4:After the system goes smoothly, you can use a magnet to change the magnetic field and see if there is any change. ==Result== There will be a simple compass displayed on the screen and the pointer will change along with the magnetic field. As follows: [[File:compass_simulatorResult.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
帮助
常见问题
帮助
工具
链入页面
相关更改
特殊页面
页面信息