View Single Post
  #1   Spotlight this post!  
Unread 03-05-2012, 12:57
kobitate94's Avatar
kobitate94 kobitate94 is offline
Webmaster
FRC #1683 (Techno Titans)
Team Role: Webmaster
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Johns Creek, Georgia
Posts: 7
kobitate94 is on a distinguished road
Exclamation Exporting text file for FTP access

Hi all.

Our team is participating in a kind of school carnival we call TitanFest. Since we already have a basketball hoop set up from our practice field, we have decided to run a basketball booth. I have created a scoreboard that grabs the score from a file and updates the score shown (it uses jQuery).

We are programming the scoring mechanism itself using an old robot's cRIO due to lack of time (it's tomorrow...). What we are having trouble with is getting the score to export to a text file. The score is simply an int that updates whenever the player scores. How can I get the score into a text file on the "robot" so that I can access it through the IP address? Here is the code that grabs the text file in case that makes a difference (it grabs it from the FTP sever it is hosted on as of now):

Code:
 $(document).ready(function() {
 	 $("#myscore").load("score.txt");
   var refreshId = setInterval(function() {
      $("#myscore").load('score.txt');
   }, 1000);
   $.ajaxSetup({ cache: false });
});
The code simply reloads the DIV with the ID "myscore" and replaces its text with what it sees in score.txt.

Edit: I put up another topic on this but I deleted it now that we have sort of changed how we were doing it.

Last edited by kobitate94 : 03-05-2012 at 12:59. Reason: minor detail
Reply With Quote