当前位置: 首页>>代码示例>>C++>>正文


C++ SerialStream::SetNumOfStopBits方法代码示例

本文整理汇总了C++中SerialStream::SetNumOfStopBits方法的典型用法代码示例。如果您正苦于以下问题:C++ SerialStream::SetNumOfStopBits方法的具体用法?C++ SerialStream::SetNumOfStopBits怎么用?C++ SerialStream::SetNumOfStopBits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SerialStream的用法示例。


在下文中一共展示了SerialStream::SetNumOfStopBits方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Serial_Open_Port

void Serial_Open_Port(string comPort)
{
        serial_port.Open( comPort ) ;
        if(! serial_port.good())
	{
		std::cerr<<"Error: could not open serial port"<<std::endl;
		exit(1);
	}
        serial_port.SetBaudRate( SerialStreamBuf::BAUD_9600) ;
        serial_port.SetCharSize( SerialStreamBuf::CHAR_SIZE_8 ) ;
        serial_port.SetNumOfStopBits(1) ;
        serial_port.SetParity( SerialStreamBuf::PARITY_EVEN ) ;
        serial_port.SetFlowControl( SerialStreamBuf::FLOW_CONTROL_NONE ) ;
}
开发者ID:sojoe02,项目名称:RSD,代码行数:14,代码来源:serial_fct.cpp

示例2: serialport_open

void serialport_open(const char* sp) {
    /*The arduino must be setup to use the same baud rate*/
    fprintf(stdout, "Setting Params:\n");
    ardu.SetBaudRate( SerialStreamBuf::BAUD_115200 ) ;
    ardu.SetCharSize( SerialStreamBuf::CHAR_SIZE_8 ) ;
    ardu.SetNumOfStopBits(1) ;
    ardu.SetParity( SerialStreamBuf::PARITY_ODD ) ;
    ardu.SetFlowControl( SerialStreamBuf::FLOW_CONTROL_HARD ) ;
    ardu.SetVTime(1);
    fprintf(stdout, "Opening:\n");
    ardu.Open( sp ) ;
    fprintf(stdout, "Opened:\n");

}
开发者ID:samzapo,项目名称:ServoController,代码行数:14,代码来源:ServoDriver.cpp

示例3: main

int main(int argc,char** argv)
{
	char response[3];

	serial_stream.Open( argv[1] ) ;
	serial_stream.SetBaudRate( SerialStreamBuf::BAUD_115200 ) ;
	serial_stream.SetCharSize( SerialStreamBuf::CHAR_SIZE_8 ) ;
	serial_stream.SetFlowControl( SerialStreamBuf::FLOW_CONTROL_NONE ) ;
	serial_stream.SetParity( SerialStreamBuf::PARITY_NONE ) ;
	serial_stream.SetNumOfStopBits(0) ;
	
	while (1)
	{
		serial_stream<<"ABCD";
		cout<<"waiting response"<<endl;
		serial_stream.read(response,3);
		cout<<response<<endl;
	}
	return 0;
}
开发者ID:thriller91,项目名称:Cansat-SupOp,代码行数:20,代码来源:comm1.cpp

示例4: init_connection

void init_connection(SerialStream& stream)
{

	stream.Open("/dev/ttyUSB0");
	if (stream.IsOpen()){
		cout << "\tStream open" << endl;
	} else {
		cout << "\tCould not open stream" << endl;
		exit(1);
	}

	//Connection Characteristics
	stream.SetBaudRate(SerialStreamBuf::BAUD_9600);
	stream.SetCharSize(SerialStreamBuf::CHAR_SIZE_8);
	stream.SetNumOfStopBits(1);
	stream.SetParity(SerialStreamBuf::PARITY_NONE);
	stream.SetFlowControl(SerialStreamBuf::FLOW_CONTROL_HARD); //??
	stream.SetVMin(1000);

}
开发者ID:cartejac,项目名称:AVR_motor_controlling,代码行数:20,代码来源:serial_int.cpp

示例5: QObject

Server::Server(DomParser* _parser): QObject(0)
{
  parser = _parser;
  connect(&server, SIGNAL(newConnection()), this, SLOT(acceptConnection()));

  serial_port.Open(ARDUINO) ;
     if ( ! serial_port.good() )
     {
         std::cerr << "[" << __FILE__ << ":" << __LINE__ << "] "
                   << "Error: Could not open serial port."
                   << std::endl ;
         exit(1) ;
     }
     //
     // Set the baud rate of the serial port.
     //
     serial_port.SetBaudRate( SerialStreamBuf::BAUD_9600 ) ;
     if ( ! serial_port.good() )
     {
         std::cerr << "Error: Could not set the baud rate." <<
std::endl ;
         exit(1) ;
     }
     //
     // Set the number of data bits.
     //
     serial_port.SetCharSize( SerialStreamBuf::CHAR_SIZE_8 ) ;
     if ( ! serial_port.good() )
     {
         std::cerr << "Error: Could not set the character size." <<
std::endl ;
         exit(1) ;
     }
     //
     // Disable parity.
     //
     serial_port.SetParity( SerialStreamBuf::PARITY_NONE ) ;
     if ( ! serial_port.good() )
     {
         std::cerr << "Error: Could not disable the parity." <<
std::endl ;
         exit(1) ;
     }
     //
     // Set the number of stop bits.
     //
     serial_port.SetNumOfStopBits( 1 ) ;
     if ( ! serial_port.good() )
     {
         std::cerr << "Error: Could not set the number of stop bits."
                   << std::endl ;
         exit(1) ;
     }
     //
     // Turn off hardware flow control.
     //
     serial_port.SetFlowControl( SerialStreamBuf::FLOW_CONTROL_NONE ) ;
     if ( ! serial_port.good() )
     {
         std::cerr << "Error: Could not use hardware flow control."
                   << std::endl ;
         exit(1) ;
     }

  server.listen(QHostAddress::Any, 8888);
}
开发者ID:uUlmKnierim,项目名称:everywhereDisplaySoftware,代码行数:66,代码来源:server.cpp


注:本文中的SerialStream::SetNumOfStopBits方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。