資源簡介
這是wifi robot的C# 上位機 很簡單的功能實現 視頻顯示 和兩個舵機的控制,其中控制指令和我下位的單片機指令有關,所以僅供參考。并沒有什么原創性,就不要分了。

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Net;
using?System.IO;
using?System.Net.Sockets;
using?System.Windows.Forms;
using?System.Runtime.InteropServices;
namespace?wifiRobot
{
????public?partial?class?XWSRobot?:?Form
????{
????????public?XWSRobot()
????????{
????????????InitializeComponent();
????????}
????????string?CameraIp?=?“http://192.168.2.1:8080/?action=snapshot“;
????????string?ControlIp?=?“192.168.2.1“;
????????string?Port?=?“2001“;
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????timer1.Enabled?=?true;
????????}
????????private?void?timer1_Tick(object?sender?EventArgs?e)
????????{
????????????//pictureBox1.ImageLocation?=?CameraIp;//?“http://192.168.2.1:8080/?action=snapshot“;
????????????string?CameraIp?=?“http://192.168.2.1:8080/?action=snapshot“;
????????????byte[]?buffer?=?new?byte[100000];
????????????int?read?total=0;
????????????HttpWebRequest?req?=?(HttpWebRequest)WebRequest.Create(CameraIp);
????????????WebResponse?resp?=?req.GetResponse();
????????????Stream?stream?=?resp.GetResponseStream();
????????????while?((read?=?stream.Read(buffer?total?100))?!=?0)
????????????{
????????????????total?+=?read;
????????????}
????????????Bitmap?bmp?=?(Bitmap)Bitmap.FromStream(new?MemoryStream(buffer?0?total));
????????????pictureBox1.Image?=?bmp;
??
????????}
????????void?SendData(byte[]?data)
????????{
????????????try?
????????????{
????????????????IPAddress?ips?=?IPAddress.Parse(ControlIp.ToString());
????????????????IPEndPoint?ipe?=?new?IPEndPoint(ips?Convert.ToInt32(Port.ToString()));
????????????????Socket?connect?=?new?Socket(AddressFamily.InterNetwork?SocketType.Stream?ProtocolType.Tcp);
???????????????
????????????????connect.Connect(ipe);
????????????????
????????????????connect.Send(data?data.Length?0);
????????????????//connect.Close();
????????????????
????????????}
????????????catch(Exception?e)
????????????{
????????????????MessageBox.Show(e.Message);
????????????}
????????}
????????private?void?groupBox1_Enter(object?sender?EventArgs?e)
????????{
????????}
????????private?void?left_Click(object?sender?EventArgs?e)
????????{
????????????byte[]?tempbyte?=?{2551890255};
????????????SendData(tempbyte);
????????}
????????private?void?right_Click(object?sender?EventArgs?e)
????????{
????????????byte[]?tempbyte?=?{?255?1?8?135?255?};
????????????SendData(tempbyte);
????????}
???????
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????117??2014-11-15?15:35??wifiRobot\wifiRobot\app.config
?????文件??????11776??2014-11-15?15:26??wifiRobot\wifiRobot\bin\Debug\wifiRobot.exe
?????文件??????26112??2014-11-15?15:26??wifiRobot\wifiRobot\bin\Debug\wifiRobot.pdb
?????文件??????11600??2014-11-15?15:28??wifiRobot\wifiRobot\bin\Debug\wifiRobot.vshost.exe
?????文件????????490??2010-03-17?22:39??wifiRobot\wifiRobot\bin\Debug\wifiRobot.vshost.exe.manifest
?????文件???????1626??2014-11-15?17:31??wifiRobot\wifiRobot\bin\Release\wifiRobot.application
?????文件??????11776??2014-11-15?17:31??wifiRobot\wifiRobot\bin\Release\wifiRobot.exe
?????文件????????117??2014-11-15?15:35??wifiRobot\wifiRobot\bin\Release\wifiRobot.exe.config
?????文件???????4834??2014-11-15?17:31??wifiRobot\wifiRobot\bin\Release\wifiRobot.exe.manifest
?????文件??????26112??2014-11-15?17:31??wifiRobot\wifiRobot\bin\Release\wifiRobot.pdb
?????文件???????1626??2014-11-15?17:31??wifiRobot\wifiRobot\bin\Release\wifiRobot.vshost.application
?????文件??????11608??2014-11-15?17:43??wifiRobot\wifiRobot\bin\Release\wifiRobot.vshost.exe
?????文件????????117??2014-11-15?15:35??wifiRobot\wifiRobot\bin\Release\wifiRobot.vshost.exe.config
?????文件???????4834??2014-11-15?17:31??wifiRobot\wifiRobot\bin\Release\wifiRobot.vshost.exe.manifest
?????文件???????2644??2014-11-15?17:31??wifiRobot\wifiRobot\Form1.cs
?????文件???????9288??2014-11-15?16:25??wifiRobot\wifiRobot\Form1.Designer.cs
?????文件???????6011??2014-11-15?16:25??wifiRobot\wifiRobot\Form1.resx
?????文件???????5420??2014-11-15?15:23??wifiRobot\wifiRobot\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????6287??2014-11-15?15:26??wifiRobot\wifiRobot\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件????????589??2014-11-15?15:28??wifiRobot\wifiRobot\obj\x86\Debug\wifiRobot.csproj.FileListAbsolute.txt
?????文件????????975??2014-11-15?15:24??wifiRobot\wifiRobot\obj\x86\Debug\wifiRobot.csproj.GenerateResource.Cache
?????文件???????9174??2014-11-15?15:24??wifiRobot\wifiRobot\obj\x86\Debug\wifiRobot.csprojResolveAssemblyReference.cache
?????文件??????11776??2014-11-15?15:26??wifiRobot\wifiRobot\obj\x86\Debug\wifiRobot.exe
?????文件??????26112??2014-11-15?15:26??wifiRobot\wifiRobot\obj\x86\Debug\wifiRobot.pdb
?????文件????????180??2014-11-12?22:06??wifiRobot\wifiRobot\obj\x86\Debug\wifiRobot.Properties.Resources.resources
?????文件????????180??2014-11-15?15:24??wifiRobot\wifiRobot\obj\x86\Debug\wifiRobot.XWSRobot.resources
?????文件????????789??2014-11-15?15:35??wifiRobot\wifiRobot\obj\x86\Release\DesignTimeResolveAssemblyReferences.cache
?????文件???????6189??2014-11-15?17:31??wifiRobot\wifiRobot\obj\x86\Release\DesignTimeResolveAssemblyReferencesInput.cache
?????文件???????4608??2014-11-15?15:35??wifiRobot\wifiRobot\obj\x86\Release\TempPE\Properties.Resources.Designer.cs.dll
?????文件???????1626??2014-11-15?17:31??wifiRobot\wifiRobot\obj\x86\Release\wifiRobot.application
............此處省略34個文件信息
- 上一篇:usbkey開發代碼 c#
- 下一篇:C# 生等值線 等值面 算法
評論
共有 條評論