Go to Post This is a game of the mind. Size does not matter. - JohnBoucher [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #8   Spotlight this post!  
Unread 14-02-2013, 01:49
Toa Circuit's Avatar
Toa Circuit Toa Circuit is offline
Thaddeus Maximus
AKA: Thad Hughes
FRC #4213 (MetalCow Robotics)
Team Role: Leadership
 
Join Date: Nov 2012
Rookie Year: 2012
Location: Shirley, IL
Posts: 131
Toa Circuit is an unknown quantity at this point
Re: Printing to a text file

Using ofstream is fine... but one thing. When you create or open ofstream objects, the file is cleared out. If you want to keep a running log, do this so that you only create the objects once.

Code:
//imported #include <fstream>
//leftdrive, rightdrive, and myrobot(leftdrive, rightdrive) are already initilized
int counter;
ofstream left;
ofstream right;
left.open ("LEFT.txt");
right.open ("RIGHT.txt");
while (IsOperatorControl())
{
	float driverLeftY = driverXbox->GetRawAxis(2);
	float driverRightY = driverXbox->GetRawAxis(5);
	myRobot->TankDrive(-driverLeftY, driverRightY);
	while (counter <= 1500) //while (samples <= 1500)
	{
	    right << RightDrive->Get() << "," << endl; 
            left << LeftDrive->Get() << "," << endl;
	    counter++;
	    Wait(0.01);
	}					
}
left.close();
right.close();
Once you have this, use a FTP program like FileZilla to read off the cRIO flash at 10.xx.yy.2
__________________

2012 Head of Programming and Electrical
2013-14 Overall Team Captain and Programming Head
2012-14 Mentor of FLL Team Power Surge
2014 Dean's List Finalist
2014 CIR Xerox Creativity Award
Webpage
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 18:23.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi