虫虫首页| 资源下载| 资源专辑| 精品软件
登录| 注册

IF-else-end

  • Arduino学习笔记3_连接HMC5883L三轴电子罗盘传感器

    用途:测量地磁方向,测量物体静止时候的方向,测量传感器周围磁力线的方向。注意,测量地磁时候容易受到周围磁场影响,主芯片HMC5883 三轴磁阻传感器特点(抄自网上): 1,数字量输出:I2C 数字量输出接口,设计使用非常方便。 2,尺寸小: 3x3x0.9mm LCC 封装,适合大规模量产使用。 3,精度高:1-2 度,内置12 位A/D,OFFSET, SET/RESET 电路,不会出现磁饱和现象,不会有累加误差。 4,支持自动校准程序,简化使用步骤,终端产品使用非常方便。 5,内置自测试电路,方便量产测试,无需增加额外昂贵的测试设备。 6,功耗低:供电电压1.8V, 功耗睡眠模式-2.5uA 测量模式-0.6mA   连接方法: 只要连接VCC,GND,SDA,SDL 四条线。 Arduino GND -> HMC5883L GND Arduino 3.3V -> HMC5883L VCC Arduino A4 (SDA) -> HMC5883L SDA Arduino A5 (SCL) -> HMC5883L SCL (注意,接线是A4,A5,不是D4,D5) 源程序: #include <Wire.h> #include <HMC5883L.h> HMC5883Lcompass; voidsetup() { Serial.begin(9600); Wire.begin(); compass = HMC5883L(); compass.SetScale(1.3); compass.SetMeasurementMode(Measurement_Continuous); } voidloop() { MagnetometerRaw raw = compass.ReadRawAxis(); MagnetometerScaled scaled = compass.ReadScaledAxis(); float xHeading = atan2(scaled.YAxis, scaled.XAxis); float yHeading = atan2(scaled.ZAxis, scaled.XAxis); float zHeading = atan2(scaled.ZAxis, scaled.YAxis); if(xHeading < 0) xHeading += 2*PI; if(xHeading > 2*PI) xHeading -= 2*PI; if(yHeading < 0) yHeading += 2*PI; if(yHeading > 2*PI) yHeading -= 2*PI; if(zHeading < 0) zHeading += 2*PI; if(zHeading > 2*PI) zHeading -= 2*PI; float xDegrees = xHeading * 180/M_PI; float yDegrees = yHeading * 180/M_PI; float zDegrees = zHeading * 180/M_PI; Serial.print(xDegrees); Serial.print(","); Serial.print(yDegrees); Serial.print(","); Serial.print(zDegrees); Serial.println(";"); delay(100); }

    标签: Arduino 5883L 5883 HMC

    上传时间: 2014-03-20

    上传用户:tianyi223

  • 题目:请输入星期几的第一个字母来判断一下是星期几

    题目:请输入星期几的第一个字母来判断一下是星期几,如果第一个字母一样,则继续判断第二个字母。 1.程序分析:用情况语句比较好,如果第一个字母一样,则判断用情况语句或if语句判断第二个字母。

    标签: 输入 字母

    上传时间: 2015-01-08

    上传用户:JIUSHICHEN

  • This Unix C code monitors a web server every few minutes by trying to retrieve its home page. It sen

    This Unix C code monitors a web server every few minutes by trying to retrieve its home page. It sends you email when it can t connect, and every so often while the server is still down. It sends a final message when it comes back up. If you have email paging, just direct the email to your pager address.

    标签: monitors retrieve minutes server

    上传时间: 2015-01-11

    上传用户:pompey

  • Tug of War(A tug of war is to be arranged at the local office picnic. For the tug of war, the picnic

    Tug of War(A tug of war is to be arranged at the local office picnic. For the tug of war, the picnickers must be divided into two teams. Each person must be on one team or the other the number of people on the two teams must not differ by more than 1 the total weight of the people on each team should be as nearly equal as possible. The first line of input contains n the number of people at the picnic. n lines follow. The first line gives the weight of person 1 the second the weight of person 2 and so on. Each weight is an integer between 1 and 450. There are at most 100 people at the picnic. Your output will be a single line containing 2 numbers: the total weight of the people on one team, and the total weight of the people on the other team. If these numbers differ, give the lesser first. )

    标签: picnic the tug war

    上传时间: 2014-01-07

    上传用户:离殇

  • RemoteWAP is a Remote Administration Tool for any Operating System that can support the Java Virtual

    RemoteWAP is a Remote Administration Tool for any Operating System that can support the Java Virtual Machine. It has been designed for anyone who wishes to have complete control of there OS anywhere by using a WAP enabled Mobile Phone. RemoteWAP is developed using Java and WML for the client mobile phone front-end pages. RemoteWAP has a Java Swing-GUI to allow for easy control. Future releases will have a Command Line Interface for quick use

    标签: Administration RemoteWAP Operating Virtual

    上传时间: 2015-02-01

    上传用户:exxxds

  • A simple utility to split a concatenated vCard format file into separate files (IETF RFC 2426 - vCar

    A simple utility to split a concatenated vCard format file into separate files (IETF RFC 2426 - vCard MIME Directory Profile). It splits on the BEGIN:VCARD and END:VCARD tags. It was created to help import a Lotus Organizer export file into Palm Desktop

    标签: concatenated separate utility simple

    上传时间: 2013-12-20

    上传用户:gxf2016

  • What s inside :README - this fileINSTALL - installation instructionsstlport - main STLport include d

    What s inside :README - this fileINSTALL - installation instructionsstlport - main STLport include directorysrc - source and makefiles for iostreams implementationlib - installation directory for STLport library (if you use STLport iostreams only)test/regression - regression test, using wrapper iostreamstest/eh - exception handling test using STLport iostreamsetc - miscellanous files (ChangeLog, TODO, scripts, etc.)

    标签: instructionsstlport installation fileINSTALL STLport

    上传时间: 2014-01-19

    上传用户:1159797854

  • 由于时间紧迫及事先准备不足

    由于时间紧迫及事先准备不足,编译器最后定型时暴露出不少问题及不足之处,主要有以下一些方面:   不支持数组数据类型,这是文法分析器设计时的一个疏漏,由于时间关系,最后只得把扫描器中已做好的相关的数组部分删去。   对于float数据类型的支持,直到语义分析都是正常的,也能生成相应的汇编代码,但由于我们对8086/8088指令系统本身了解不足,这样的汇编代码将只能做到含义上完全忠实于源程序,但不能运行。   对于局部变量的支持,则于时间紧迫,所有的局部变量全被处理成静态变量。使递归函数不能得到正确的结果。    对于函数调用语句,不进行参数匹配检查,如果参数数量不对,也将能通过编译,但运行时将产生非法操作。   对&& !等逻辑操作在最后生成代码时处理比较粗燥,生成的代码在逻辑复杂时将不能保证运行正常。   接下来有一些,不能说是缺陷,但必须说明的问题:   对于main函数,没有参数表,通回类型也必须为void,但如果写上参数表及其他返回类型也能编译通过,生成代码时将简单地忽略,不影响最后的代码的运行。   对于while,for,if语句,其语句体不管是一句还是多句,必须都有{}围起来。这跟C语言中若是一句则可省略{}不同。

    标签:

    上传时间: 2015-03-14

    上传用户:gmh1314

  • c语言编程规范Style guidelines and programming practices for C/C++ code for Dynamic Software Solutions. Use

    c语言编程规范Style guidelines and programming practices for C/C++ code for Dynamic Software Solutions. Use the checklist at the end of this document prior to submitting code for peer review.

    标签: programming guidelines Solutions for

    上传时间: 2014-07-11

    上传用户:aeiouetla

  • 此代码可以实现以下功能 使用wordappalication 组件

    此代码可以实现以下功能 使用wordappalication 组件,代码如下 启动Word时用如下代码: begin try Wordapplication.Connect except MessageDlg(’Word may not be installed’, mtError, [mbOk], 0) Abort end Wordapplication.Visible := True WordApplication.Caption := ’Delphi automation’ end

    标签: wordappalication 代码

    上传时间: 2014-01-22

    上传用户:Divine