vs2013编程c++程序,实现对arduino传输字符串通信
ps:用电脑作为上位机,arduino2560开发板作为下位机,实现上位机对下位机进行单向数据传送。
vs编程:
在vs里创建空白项目,直接将下列代码复制进去即可
// ConsoleApplication5.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include"iostream"
#include <stdio.h>
#include <tchar.h>
#include <string>
#include<stdio.h>
using namespace std;
////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef SERIALCLASS_H_INCLUDED
#define SERIALCLASS_H_INCLUDED
#define ARDUINO_WAIT_TIME 2000
#include <windows.h>
#include <stdlib.h>
class Serial
{
private:
//Serial comm handler
HANDLE hSerial;
//Connection status
bool connected;
//Get various information about the connection
COMSTAT status;
//Keep track of last error
DWORD errors;
public:
//Initialize Serial communication with the given COM port
Serial(const char *portName);
//Close the connecti

本文介绍了如何使用VS2013编程C++程序来与Arduino 2560开发板进行字符串通信。通过电脑作为上位机,实现对Arduino开发板的单向数据传输。在VS中创建空白项目,并粘贴特定代码以实现通信功能。

1628

被折叠的 条评论
为什么被折叠?



