• 大小: 85KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-10
  • 语言: C#
  • 标签: wifirobot  

资源简介

这是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个文件信息

评论

共有 条评论

相关资源