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


C++ Serial::init方法代码示例

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


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

示例1: usci_main

/**
 * main - echo back to the user whatever they type
 */
int usci_main(void) {
    WDTCTL = WDTPW + WDTHOLD; // Stop WDT

    BCSCTL1 = CALBC1_16MHZ; // set DCO clock for MCLK and SMCLK
    DCOCTL = CALDCO_16MHZ;

    usci0.init();

    __bis_SR_register(GIE); // interrupts enabled

    usci0.xmit("\r\nMSP430G2553 Monitor\r\n$ ");

    while (true) {
        while (!usci0.empty()) {
            volatile int c;

            c = usci0.recv();
            usci0.xmit((uint8_t) c);
        }
    }
    
    return 0;
}
开发者ID:Quna,项目名称:mspdev,代码行数:26,代码来源:usci.cpp

示例2: main

int main(int argc, char * argv[])
{
    VideoCapture capture;
    if(argc>1)
    {
        capture.open(argv[1][0]-'0');
    }
    else
    {
        capture.open(0);
    }

    FileStorage fs;
    fs.open("parameters.yml", FileStorage::READ);

    if(!capture.isOpened())
    {
        cout<<"Cam Invalid"<<endl;
        return -1;
    }


    //serial initialize
    #ifdef SERIAL_PORT
    Serial serial;
    unsigned char sendBuff[10];
    if(serial.init()!=-1)
    {
        cout<<"serial init success"<<endl;
    }
    else
    {
        cout<<"serial init failed,please check the interface"<<endl;
        return -1;
    }
    #endif

    //set capture size
    capture.set(CV_CAP_PROP_FRAME_WIDTH,340);
    capture.set(CV_CAP_PROP_FRAME_HEIGHT,240);

    namedWindow("Intelisu",CV_WINDOW_NORMAL);//CV_WINDOW_AUTOSIZE
    setMouseCallback( "Intelisu", mouseHandler, NULL );

    TLD tld;
    tld.read(fs.getFirstTopLevelNode());
    Mat frame;
    Mat last_gray;
    Mat first;
    capture>>frame;//test image acquirement;
    cout<<frame.size()<<endl;
    //aquire the object patch
//    while(!gotBB)
//    {
//        if (!fromfile){
//            capture >> frame;
//        }
//        else
//            first.copyTo(frame);
//        cvtColor(frame, last_gray, CV_RGB2GRAY);
//        drawBox(frame,box);
//        putText(frame,"Wating for the object...",Point(20,20),FONT_HERSHEY_SIMPLEX,0.6,10,2);
//        //Mat scaleImage;
//        //resize(frame,scaleImage,Size(2*round(frame.cols),2*round(frame.rows)));
//        imshow("Intelisu", frame);
//        if (cvWaitKey(33) == 'q')
//            return 0;
//    }

    //motion track
    myupdate_mhi myupdate1;
    Rect result;
    Mat motion=Mat::zeros(frame.rows,frame.cols, CV_8UC1);
    for(;;)
    {
            capture>>frame;
            IplImage pframe(frame);
            IplImage pmotion(motion);

            myupdate1.init( &pframe, &pmotion, 60 );
            if(myupdate1.update_mhi(result)==0)
			{
				cout<<"x:"<<result.x+result.width/2<<"    "<<"y:"<<result.y+result.height/2<<endl;
				rectangle(frame,result, Scalar(255,0,0));
				break;
			}
			//resize(frame,frame,Size(3*round(frame.cols),3*round(frame.rows)));

            static unsigned char safeCount=0;
            putText(frame,"Environment Safe",Point(20,20),FONT_HERSHEY_SIMPLEX,0.7,CV_RGB(0,safeCount,0),2);
            safeCount+=16;

			imshow("Intelisu",frame);

			waitKey(10);

    }
    cvtColor(frame, last_gray, CV_RGB2GRAY);
    //waitKey(-1);

//.........这里部分代码省略.........
开发者ID:githubmsj1,项目名称:VisionTrack,代码行数:101,代码来源:intelisu.cpp

示例3: main

int main()
{
	//Stel onderstaande poorten in op Output en laad allemaal enen in
	DDRA=0xFF;
	DDRB=0xFF;
	DDRC=0xFF;
	PORTA=0xFF;
	PORTB=0xFF;
	PORTC=0xFF;

	//Stel de timer in die een interrupt genereert bij en overflow
	TCCR0=0x05;
	TIMSK=0x01;
	
	//Stel odnerstaande poorten in op Input en laad allemaal enen in
	DDRE=0x00;
	PINE=0xFF;

	serial.init();

	// Aanmaken van de verschillende autolichtobjecten
	AutoLicht azl(0xFE, 0xFD, 0xFB, ADRESPORTB);
	AutoLicht azr(0xF7, 0xEF, 0xDF, ADRESPORTB);
	AutoLicht ahl(0xFE, 0xFD, 0xFB, ADRESPORTC);
	AutoLicht ahr(0xF7, 0xEF, 0xDF, ADRESPORTC);

	// Aanmaken van de verschillende voetgangerlichtobjecten
	VoetgangerLicht vhr(0xFE, 0xFD, ADRESPORTA);
	VoetgangerLicht vz(0xBF, 0x7F, ADRESPORTB);
	VoetgangerLicht vhl(0xBF, 0x7F, ADRESPORTC);

	List<VoetgangerLicht*> l1, l2, l3;
	List<Scenario*> s;

	//Lijst l1 vullen
	l1.push_back(&azl);
	l1.push_back(&azr);

	//Lijst l2 vullen
	l2.push_back(&ahl);
	l2.push_back(&ahr);

	//Lijst l3 vullen
	l3.push_back(&vhr);
	l3.push_back(&vz);
	l3.push_back(&vhl);
	
	//Scenario's definieren
	Scenario s1(&l1, &variabelebeheerder);
	Scenario s2(&l2, &variabelebeheerder);
	Scenario s3(&l3, &variabelebeheerder);
	s.push_back(&s1);
	s.push_back(&s2);
	s.push_back(&s3);

	variabelebeheerder.zetAantalScenarios(3);

	//Scenario's toekennen aan sensoren
	svz.kenScenarioToe(&s3);
	svhr.kenScenarioToe(&s3);
	svhl.kenScenarioToe(&s3);
	sahr.kenScenarioToe(&s2);
	sahl.kenScenarioToe(&s2);
	sazl.kenScenarioToe(&s1);
	sazr.kenScenarioToe(&s1);

	VerkeersRegelaar vr(&s, &wachtrijbeheerder, &variabelebeheerder);
	
	sei(); //Zet interrupts aan

	while(1) {
		vr.kiesFunctie();
	}
}
开发者ID:Elora,项目名称:verkeersplein,代码行数:74,代码来源:Verkeersplein.c


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