led.cpp

来自「一个串口通信好例子,是完整的VC++工程,很值得初学者学习.」· C++ 代码 · 共 48 行

CPP
48
字号
// LED.cpp: implementation of the CLED class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ParkSys.h"
#include "LED.h"
#include "vicpublic.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CLED::CLED(CSerialPort* commLED)
{
	if(commLED == NULL)
	{
		THROW(new CException);		
	}
	else
	{
		m_comm = commLED;
	}
}

CLED::~CLED()
{
	m_comm = NULL;
}

void CLED::TakeEffect(const CString& strScript)
{
	if(m_comm == NULL)
	{
		THROW(new CException);
		return;
	}	
	char buf[500];
	wsprintf(buf, "%s", strScript);
	m_comm->WriteToPort(buf);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?