Pages: [1]   Go Down
Author Topic: Thinker Proxy + flash broken data  (Read 1148 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 102
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm using thinker proxy to interface arduino-to-flash but I'm receiving LOST/Broken data.

My arduino is outputing: "1000000000000000"

and the flash receives:

"100
0000000000000"

or

"1
000000
0000
00000"

What's the problem??

Please help me  smiley-cry smiley-cry
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm using thinker proxy

You're using what? Is there a link to that?
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 102
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's a socket-to-serial for using arduino with flash:

http://code.google.com/p/tinkerit/wiki/TinkerProxy

Please help me smiley-sad
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Where's your code? Are we supposed to guess what you have running?
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 102
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

//import flash.errors.*;
At flash:

import flash.events.*;
import flash.net.Socket;
var serial:String;
//Create a socket connection to the deafult tinkerProxy port
var arduinoSocket:Socket = new Socket("localhost",5334);
arduinoSocket.addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler);

function readResponse():void
{
   serial = arduinoSocket.readUTFBytes(arduinoSocket.bytesAvailable);
   touch(serial);
}

function socketDataHandler(event:ProgressEvent):void
{
   readResponse();
}


and at arduino is a simple
println("1000000000000000")
   trace(serial);
}
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 640
Posts: 50335
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
and at arduino is a simple
println("1000000000000000")
   trace(serial);
}
No, that is not the code on the Arduino. Try again.

Then, you need to understand how serial data transmission works. The data is sent one byte at a time. Slowly.

Your PC app reads all the serial data that has arrived, and assumes that that is a complete packet. It is not. When you consider ways to delimit the packets being sent, and read and store data until a complete packet arrives, your problems will be solved.

How to do that only comes up about 3 times a week on the forum, so it might take you a few seconds to find some solutions.
Logged

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

How to do that only comes up about 3 times a week on the forum, so it might take you a few seconds to find some solutions.

Please dont do this. At least give a hint or a example link. I know how you hate repeating yourself, of course. Me too. But here are reading also non-native english speaker like me and I had a hard time finding a thread like this that has the same problem like me, and now I'm again stuck, as I dont know what I have to search for in the forum. This thread describes my problem and you just end it with a blind alley.

Can you please give me a pointer or terms I can use to find those 3-times-a-week-threads?  smiley-confuse


Greetings from Germany
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 640
Posts: 50335
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There are several people who have undertaken to post details about how to read serial data. I post quite regularly. Nick has put up a web site with details: http://www.gammon.com.au/forum/?id=11425. Here's another one: http://jhaskellsblog.blogspot.com/2011/05/serial-comm-fundamentals-on-arduino.html
Logged

Pages: [1]   Go Up
Jump to: