vs2016编程c++程序,实现对arduino传输字符串通信
vs2013编程c++程序,实现对arduino传输字符串通信
ps:用电脑作为上位机,arduino2560开发板作为下位机,实现上位机对下位机进行单向数据传送。
vs编程:
在vs里创建空白项目,直接将下列代码复制进去即可
// ConsoleApplication5.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include"iostream"
#include
#include
#include
#include
using namespace std;#ifndef SERIALCLASS_H_INCLUDED
#define SERIALCLASS_H_INCLUDED
#define ARDUINO_WAIT_TIME 2000
#include
#include class Serial
{
private://Serial comm handlerHANDLE hSerial;//Connection statusbool connected;//Get various information about the connectionCOMSTAT status;//Keep track of last errorDWORD errors;public://Initialize Serial communication with the given COM portSerial(const char *portName);//Close the connection~Serial();//Read data in a buffer, i
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
