查看: 951|回复: 0

pcDuino与Arduino通过xbee模块实现双灯互控

[复制链接]
  • TA的每日心情
    奋斗
    2016-4-25 13:46
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]初来乍到

    发表于 2013-6-3 18:15:31 | 显示全部楼层 |阅读模式
    分享到:
    操作演示如下:
    一、 I2C的连线方式如图

    正面

    背面

    二、线路连接好之后,打开LXTerminal,进入目录,如图所示



    三.打开代码,见下图

    四、、代码打开成功之后,输入make进行编译,出现可执行文件,如下图

    五、 运行代码,简单快捷的I2C通信就能在您的Pcduino上实现了

    /*This sketch prints "Hello World!" to the LCDand shows the time.The circuit:* 5V to Arduino 5V pin* GND to Arduino GND pin* SCL to Analog #5* SDA to Analog #4*/ include the library code:#include <core.h>#include "Wire.h"#include "LiquidCrystal.h"// Connect via i2c, default address #0 (A0-A2 not jumpered)LiquidCrystal lcd(0);void setup() {// set up the LCD's number of rows and columns:lcd.begin(16, 2);// Print a message to the LCD.lcd.print("hello, world!");}void loop() {// set the cursor to column 0, line 1// (note: line 1 is the second row, since counting begins with 0):lcd.setCursor(0, 1);// print the number of seconds since reset:lcd.print(millis()/1000);lcd.setBacklight(HIGH);delay(500);lcd.setBacklight(LOW);delay(500);}
    回复

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /2 下一条

    手机版|小黑屋|与非网

    GMT+8, 2024-4-17 05:51 , Processed in 0.123174 second(s), 17 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.