arduinowifi通信|求助如何在基于安卓通过WiFi与Arduino通信实现对LED灯的控制
绝绝子88人阅读

㈠ arino 可以链接wifi吗
为其他没有互联网功能的Arino板上传程序,就只能通过连接在PC上的线或者编程器来完成。而Arino Yun不但可以这么用,而且可以通过有线网络以及无线网络为它编程。也就是说,你可以在家为远在千里之外的Arino Yun更新程序。连接到OpenWrt-Yun的方式有三种,为了满足读者的各种要求,这里将三种方法统统道来。使用WiFi连接使用WiFi连接Arino Yun可以说是最方便的方式。在Arino Yun的初始状态下,它的板载WiFi是作为一个热点工作的。也就是说,它现在就和我们的无线路由器是类似的,你可以使用有WiFi功能的手机或者电脑连接它(虽然不一定能访问互联网)。这个热点的名称是以“Arino Yun-MAC地址”这种方式命名的,如图3.1所示为在使用手机中发现的Arino热点。同样,你可以在有WiFi功能的电脑中找到它这个热点是开放的(即没有加密),所以任何人都可以连接它。无论以何种方式连接,你都可以在浏览器中输入IP地址192.168.240.1来连接到Arino Yun。如果出现了如图3.3所示的页面,那么你现在就可以跳到3.2节进行设置了。
㈡ 求助如何在基于安卓通过WiFi与Arino通信,实现对LED灯的控制。
项目需要的硬件如下:Arino Uno Ethernet Shield LED灯 2个. 电阻 2个. 面包板(可选) 连接导线 路由器一个项目要的连接管脚如下:LED 1 --> pin 6 to ground LED 2 --> pin 7 to ground项目需要的软件如下:Eclipse IDE Arino IDE 1.x.xLED 1 --> pin 6 to ground LED 2 --> pin 7 to ground项目需要的软件如下:Eclipse IDE Arino IDE 1.x.xStep 1: 在 Arino上编程如下:#include "etherShield.h"#include "ETHER_28J60.h"int led2 = 7;int led1 = 6;static uint8_t mac[6] = {0xAA, 0xBB, 0xCC, 0xDD, 0xBB, 0xAA}; // this just needs to be unique for your network, // so unless you have more than one of these boards // connected, you should be fine with this value. static uint8_t ip[4] = {192, 168, 0, 15}; // the IP address for your board. Check your home hub // to find an IP address not in use and pick that // this or 10.0.0.15 are likely formats for an address // that will work.static uint16_t port = 80; // Use port 80 - the standard for HTTPETHER_28J60 e;void setup(){ e.setup(mac, ip, port); pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); digitalWrite(led1, LOW); digitalWrite(led2, LOW);}void loop(){ char* params; if (params = e.serviceRequest()) { if (strcmp(params, "?cmd=1") == 0) { digitalWrite(led1, HIGH); } if (strcmp(params, "?cmd=2") == 0) { digitalWrite(led1, LOW); } if (strcmp(params, "?cmd=3") == 0) { digitalWrite(led2, HIGH); } if (strcmp(params, "?cmd=4") == 0) { digitalWrite(led2, LOW); } e.respond(); }}Step 2: 制作安卓APPpackage com.androidarino;import org.apache.http.client.HttpClient;import org.apache.http.client.methods.HttpGet;import org.apache.http.impl.client.DefaultHttpClient;import android.app.Activity;import android.os.Bundle;import android.os.StrictMode;import android.view.Menu;import android.view.View;import android.view.View.OnClickListener;import android.widget.Toast;public class MainActivity extends Activity implements OnClickListener{@Overrideprotected void onCreate(Bundle savedInstanceState) { StrictMode.ThreadPolicy policy = new StrictMode. ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); super.onCreate(savedInstanceState); setContentView(R.layout.main); View led1on = findViewById(R.id.led_1on); View led1off = findViewById(R.id.led_1off); View led2on = findViewById(R.id.led_2on); View led2off = findViewById(R.id.led_2off); led1on.setOnClickListener(this); led1off.setOnClickListener(this); led2on.setOnClickListener(this); led2off.setOnClickListener(this);}@Overridepublic boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true;}public void commandArino(String url){ try { HttpClient httpclient = new DefaultHttpClient(); httpclient.execute(new HttpGet(url)); } catch (Exception e) { }}public void onClick(View thisView) { switch(thisView.getId()){ case R.id.led_1on: commandArino("http://192.168.0.15/?cmd=1"); Toast.makeText(getApplicationContext(), "led_1on",Toast.LENGTH_LONG).show(); break; case R.id.led_1off: commandArino("http://192.168.0.15/?cmd=2"); Toast.makeText(getApplicationContext(), "led_1off",Toast.LENGTH_LONG).show(); break; case R.id.led_2on: commandArino("http://192.168.0.15/?cmd=3"); Toast.makeText(getApplicationContext(), "led_2on",Toast.LENGTH_LONG).show(); break; case R.id.led_2off: commandArino("http://192.168.0.15/?cmd=4"); Toast.makeText(getApplicationContext(), "led_2off",Toast.LENGTH_LONG).show(); break; }}}
㈢ Wifi模块如何与arino uno通讯
看你 wifi 模块接口 主要有串口和 spi两种
㈣ arino与电脑利用wifi数据互通,是怎么实现的
Arino主流的板卡有(综合性能从小至大):1.Arino UNO(主控芯片:ATmega328P 8位 AVR)2.Arino MEGA(主控芯片:ATmega328P 8位 AVR)3.Arino DUE(主控芯片:32位 ARM Cortex-M3)1是最基础的入门级Arino;2的I\O口非常多,外接设备很方便;3的话一下跨到了ARM M3,处理性能和速度一下抬升了一个量级。一、编译环境:跟51、MSP430或者STM32等等MCU(单片机)不同,Arino的集成开发环境(IDE)基于Process IDE开发,使用的基本语句对AVR-GCC库进行了二次封装,已经很完善了,很多寄存器不需要使用者亲自配置,一个函数就能解决一个功能块。集成开发环境:①原生开发环境 Arino IDE : 界面挺简洁的,识别板卡型号与连接端口,编译代码之后可以直接下载进板卡里。②Visual Studio 201x :插件介绍:Visual Studio是个很棒的综合软件开发平台,同时有很多拓展插件可以提升其功能,就比如本次介绍的Arino硬件开发插件 (3). 插件可以在线更新,速度不算慢。而且更新特别勤,平均一到两周更新一次。(在此感慨一下开源硬件旺盛的生命力)下载地址 : Arino IDE for Visual Studio extension( 下完点击安装就可以了,最好安装在VS的目录下 )( 下完点击安装就可以了,最好安装在VS的目录下 )二、烧写代码的原理:电脑端跟Arino端进行串口通信,将由IDE里的编译器编译出的机器码写进芯片内RAM里的程序存储区,PC指针按顺序逐条运行指令。
㈤ arino uno r3可以使用wifi或区域网实现远程控制吗,说一下详细做法和r3参数
你想远程控制电脑开机还是远程控制家电还是远程控制让家里的电脑工作???
㈥ 怎么将无线模块和arino板子通讯
就是抄两块arino之间的蓝牙通信袭。因为发现网上貌似没有太具体的教程(反正我做的时... arino用的是2块mango板子。蓝牙模块用到是open jumper的。= =我知道很贵,是白富...
㈦ arino 有了wifi怎么和上位机通讯
一般来说是串口。衍生出 485,红外, wifi, 蓝牙,以太网, 315M/433M无线 等手段, 甚至控制LED闪光都可以让另外的计算机识别到。
㈧ 您好,我最近在做一个项目,需要通过wifi模块,进行手机和arino之间的通信。
㈨ 如何使用Arino 制作 串口转WiFi的服务器
#include<WiShield.h>#defineWIRELESS_MODE_INFRA1#defineWIRELESS_MODE_ADHOC2//----------------------------------------bytelocal_ip[]={10,0,0,3};//IPaddressofWiShieldbytegateway_ip[]={10,0,0,1};//routerorgatewayIPaddressbytesubnet_mask[]={255,255,255,0};//subnetmaskforthelocalnetworkprog_charssid[]PROGMEM={"cutedigi"};//max32bytesunsignedcharsecurity_type=0;//0-open;1-WEP;2-WPA;3-WPA2//WPA/WPA2passphraseconstprog_charsecurity_passphrase[]PROGMEM={"big_secret"};//max64characters//WEP128-bitkeys//sampleHEXkeysprog_ucharwep_keys[]PROGMEM={0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,//Key00x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//Key10x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//Key20x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00//Key3};//setupthewirelessmode//infrastructure-connecttoAP//adhoc-connecttoanotherWiFideviceunsignedcharwireless_mode=WIRELESS_MODE_INFRA;unsignedcharssid_len;unsignedcharsecurity_passphrase_len;
㈩ Arino远距离无线通讯可以多对一吗
不是都堆积在距离无线通讯的过程中是可以的,只不过是最好不要用。
评论 | 0 条评论
登录之后才可留言,前往登录