Pages: 1 [2]   Go Down
Author Topic: Arduino Result to text file  (Read 2309 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

According to this microsoft article
http://support.microsoft.com/kb/115831
COM ports higher than 9 are named like this: \\.\COM10

I don't have windows 7 to test it, but I think it will work if you change the line to:
Code:
  com = fso.OpenTextFile("\\\\.\\COM25:9600,N,8,0", ForReading)


I changed the code line it also didn't work !! I still get the same problem !! could there be something wtrong with the Arduino Code itself ???



What have you done so far?


I have this Arduino Code
int configPin = 13;                 //Set the sonar Calibration Pin

int value = 877;
char buffer[5];

void setup() {                    //begin of program
Serial.begin(9600);   //serial baud rate 9600

pinMode(configPin,OUTPUT);       //make Calibration pin output
}
void loop(){                     //looping of program
digitalWrite(configPin,HIGH);    //raise the reset pin high
delay(120);                      //start of calibration ring
float sensorvalue = analogRead(0); //get analog sensor value from pin 0
float inchvalue = (254.0/1024.0) *2.0* sensorvalue ; //convert to inches
//float cm=inchvalue*2.54;
//Serial.print("Sensed a-d value:"); //print a-d text
//Serial.println(sensorvalue);       //print a-d value
Serial.print("Inch value=");      //print inch text
Serial.println(inchvalue);
//Serial.print("cm=");
//Serial.println(cm);
delay(500);                      //optional delay 1 second
digitalWrite(configPin,LOW);      //turn off Calibration ring and sensor
delay(500);                      //delay 1 second
Serial.print("#S|LOGTEST|[");
Serial.print(itoa((value), buffer, 10));  //function. Itoa() is a function that will take an integer and return it
//converted to it’s string representation.
Serial.println("]#");
}


I can't understand how to display the results on Gobetwino smiley


thanks a lot again smiley
Logged

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1411
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I changed the code line it also didn't work !!
What error do you get?
Can you see COM25 in the device manager?
Logged

UK
Offline Offline
Shannon Member
****
Karma: 184
Posts: 11197
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I can't understand how to display the results on Gobetwino smiley

The Arduino code looks reasonable, and should print out lines like "#S|LOGTEST|[xxx]#" every second or so. Do you see those lines appear correctly in the serial monitor in the Arduino IDE?

You need to install Gobetwino on your PC and then launch it by running Gobetwino.exe. In Windows 7, in order for Gobetwino to be able to save configuration changes you need to run it with administrator privileges. Your Arduino should be connected to the USB port and running your sketch before you launch Gobetwino. You must not have any other applications running which use the Arduino's serial port, such as the Arduino IDE. People have also reported problems with management software for mobile devices which connect by USB such as phones - some of this software probes serial ports and interfere with other applications trying to use them. If you have this type of software installed and have trouble getting Gobetwino to recognise your Arduino, try stopping them.

Gobetwino opens a window which has a menu bar with three menus: File, Settings, Commands. Click on Settings to display the Gobetwino configuration window and then click on the Serial Port tab. Here you need to select the serial port corresponding to your Arduino. You should also have the baud rate set to 9600, data bits set to 8, parity set to none, stop bits set to one, handshake set to none. Click the Update button to save your changes. Display the Status and Log tab and select (tick) Show Status Messages and Log Status Messages, and set the status message level to 1. Click the Update button to save your changes. Then click Exit to close the configuration window.

You only need to do the actions above once. After making these changes, I seem to remember it was necessary to exit Gobetwino and restart it in order for these changes to take effect - but I did this a long time ago and may have mis-remembered.

After you restart Gobetwino you should see a message like "Serial port : COMx opened at 9600 baud" followed by the output from your sketch. At this stage you won't have configured Gobetwino to recognise the commands so it should log them but not do anything about them. I suggest you confirm you've got this far before you try configuring the commands.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Copenhagen / Denmark
Offline Offline
Edison Member
*
Karma: 5
Posts: 2360
Do it !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
Serial.print("Inch value=");      //print inch text
Serial.println(inchvalue);
//Serial.print("cm=");
//Serial.println(cm);
delay(500);                      //optional delay 1 second
digitalWrite(configPin,LOW);      //turn off Calibration ring and sensor
delay(500);                      //delay 1 second
Serial.print("#S|LOGTEST|[");
Serial.print(itoa((value), buffer, 10));  //function. Itoa() is a function that will take an integer and return it
//converted to it’s string representation.
Serial.println("]#");

This look to me like you are sendeing something to GoBetwino AND something that is not meant to go to GoBetwino. That will not work. When you use GoBetwino you can ONLY send well formed GoBetwino commands, otherwise GoBewtino will try to interpret it a commands and fail miserably.

I bet you get all kinds of errormessage in he GoBetwino window - right ?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I changed the code line it also didn't work !!
What error do you get?
Can you see COM25 in the device manager?


Well Yes I Can Find it in the Device manager ! smiley


This look to me like you are sendeing something to GoBetwino AND something that is not meant to go to GoBetwino. That will not work. When you use GoBetwino you can ONLY send well formed GoBetwino commands, otherwise GoBewtino will try to interpret it a commands and fail miserably.

I bet you get all kinds of errormessage in he GoBetwino window - right ?



I can't understand how to display the results on Gobetwino smiley



. Your Arduino should be connected to the USB port and running your sketch before you launch Gobetwino. You must not have any other applications running which use the Arduino's serial port, such as the Arduino IDE.



well Thanks a looooooot guys !! cause when I removed the code lines
//Serial.print("Inch value=");      //print inch text
//Serial.println(inchvalue);
and when I closed the Arduino IDE It Worked perfectly !!!!!!
thanks a looot and all my respect ! smiley

you helped a lot !
Logged

UK
Offline Offline
Shannon Member
****
Karma: 184
Posts: 11197
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This look to me like you are sendeing something to GoBetwino AND something that is not meant to go to GoBetwino. That will not work.
 When you use GoBetwino you can ONLY send well formed GoBetwino commands, otherwise GoBewtino will try to interpret it a commands and fail miserably.

In my experience Gobetwino copes fine with non-command messages, it logs them and carries on just as you'd hope.

However, having the Arduino's serial port held open by another application will definitely stop Gobetwino from working.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

well they were commands when you posted your advice I used "// " (comments ) I mean after your advice i used them as non-command smiley you were helpful !
Logged

Pages: 1 [2]   Go Up
Jump to: