Re: Script editors

2013-05-03 Thread Claudi Cornaz
Hi,

I am working on a tool, "stackally", which show's all handlers of a event in a 
tree view. 
A event means: everything that happens from the start of a message till the end 
of that message.
Well that's the most important feature of the tool, besides showing which 
handlers have changed between any 2 scans and naturally can store the different 
scans, a bit like a backup. You can permanently keep any scan and besides that, 
it will automatically keep the last x scans you made. (first in, first out)

I still need to do some work on it tough, besides incorporating the 2 new 
handler types, before and after. (these change the messagePath order as you 
might say, so I need to change that part of the code to adopt this so I can 
create the correct tree view.

I still have to think about the licensing. I spend a awfull long time on this 
and I certainly
need the money. One thing I will surely do is make a free reader available, 
which can display all scans, but you won't be able to scan a stack with the 
reader. 

I think the free reader might be a realy good help for people starting with 
livecode.
I guess they need documentation and good complete working samples. I know this 
has been talked a lot about before on this list, and I believe, now it is even 
more necesary so we can atract a lot of new people. People who are eager to 
start coding in this wonderfull world called livecode. 

So for instance a good, completly functioning notepad or simpletext app would 
be very usefull demo.
To learn the new text and paragraph features I started one which is almost 
done, at least for the mac, for now. This demo needs to be able to open and 
save text documents and of course it needs the splash screen aproach. It needs 
menus, preferences and all the new text and paragraph features fully working, 
including the setting of tabstops and margins in paragraphs. It needs all the 
works. This will surely be my
first demo with scan available with the stackAlly reader. It will make 
understanding this 'complex' demo, 
which has a lot of code, a lot easier. You don't need to go hunting through all 
the different scripts
to find the next routine that gets called. ((this also shows you the 
messagePath) It's all there, everything related is nicely viewable in a tree 
view, easy accesable. It's also very usefull to just look up how the menuPick 
message is handled for instance, or any other message that's used in this or 
other demo of course.

Anyway I hope to have some time to create the first 'finished' version soon.

If you are interested please drop me a line. And if enough people are 
interested, well it would
justify me spending some more time to finish stackAlly quickly.

All the best,
   Claudi



On 1 mei 2013, at 16:01, Martin Koob wrote:

> I think be good to see all scripts at once but not in one long document but
> rather in a tree which would show the context.   The new project browser
> shows the stack structure in a tree format.   You can click on the script
> button in the project browse and open the scripts in the tabbed script
> browser but then you still loose the context the script was in.   If instead
> of a tabbed script editor there was a tree script editor you could see how a
> button script relates to the script of the group it is in which relates to
> the script of the card it is and so on.
> 
> Martin
> 
> 
> 
> --
> View this message in context: 
> http://runtime-revolution.278305.n4.nabble.com/Script-editors-tp4664072p4664076.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: display error bug for long lines in fields?

2012-10-14 Thread Claudi Cornaz
Hi Klaus,

I have come acros this aswell. I found it has to do
with the tabsstops. If you have many tabs in the line and the tabstops
set to a 'big' number, I guess the last part of the line somehow exceeds 
a "graphic" limit. I managed to solve it by making the tabstops a bit smaller,
so that the pixels occupied by the line became less.
Hope this helps

All the best,
   Claudi


On 13 okt 2012, at 13:11, Klaus on-rev wrote:

> Hi friends,
> 
> someone already experienced this?
> 
> I have some long, but not too long, TAB delimited lines in a list field.
> 
> Now some lines look like the very last item is on top of the first item, like 
> this one:
> 
> 
> And ALL of the lines do only hile a couple of pixels at the beginning, only 
> part of the first character.
> 
> I checked the length of these lines, but they are lower than the official 
> limits:
> Max characters per line in a field = 16 bit = 64 kb
> LENGTH() of the lines is actually shorter than this limit < 6000.
> 
> I already have a workaround, but wanted to know if this is a bug, before I 
> report this.
> 
> Any hints much appreciated, thanks!
> 
> 
> Best
> 
> Klaus
> 
> 
> --
> Klaus Major
> http://www.major-k.de
> kl...@major.on-rev.com
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to get all message names

2012-02-02 Thread Claudi Cornaz
Hi All,

Thanks for answering.

Unfortunatly there apparently isn't a easy consistent way. Pitty. I need it for 
stackAlly and
it looks to get the messageNames it depends on how the version of livecode
uses it for the dictionaire, which ofcourse might change with each release. 
So no relaible stabble  way to get the message names. Most unfotunate

Björnke, apparently you can get it out of the dictionaire (the sglite db file 
on disk)
Could you share/mail me how to do that? Would be great.

Thanks all and best wishes,
   Claudi




On 30 jan 2012, at 23:04, Björnke von Gierke wrote:

> If you need help, just ask me directly :)
> 
> On 30.01.2012, at 18:01, Mike Bonner wrote:
> 
>> Ok so maybe its an encoded array of xml data. I'm thinking use the sqlite
>> db generated by the bvgdocu to do this.
>> 
>> On Mon, Jan 30, 2012 at 9:55 AM, Mike Bonner  wrote:
>> 
>>> This may be a roundabout method but.. If you go here
>>> http://bjoernke.com/index.irev?target=bvgdocu  and download bvgdocu 2.0
>>> it generates an sqlite database of the dictionary where the "type" column
>>> contains the type of entry. Message, etc.  It might be possible to use the
>>> sqlite db directly, and if not dig around and see exactly how the info was
>>> generated.
>>> 
>>> After poking around in the code it appears that the .index files located
>>> in  (C:\Program Files (x86)\RunRev\LiveCode 5.0.2\Documentation) are
>>> encoded arrays. So some method similar to what bvg did should work to
>>> extract the info you are looking for directly from the files. Maybe?
>>> Haven't done it so my level of clue on this stuff is still pretty low.
>>> 
>>> 
>>> On Mon, Jan 30, 2012 at 8:34 AM, Klaus on-rev wrote:
>>> 
 Hi Craig,
 
 Am 30.01.2012 um 16:08 schrieb dunb...@aol.com:
 
> Clever, Klaus.
 
 :-)
 
 But this is only step 1...
 
> But there are lots of groups in the stack "revDictionary". I selected
 "message" to load the DG, and then went through each group and tried to
 extract the dgText which contained, say, "mouseUp". Nothing. Do you know
 what the name of the dataGrid is?
 
 No, sorry, I just looked by myself and that is very well hidden somehow.
 
> And why would my method not work?
 
 Sorry, no idea.
 
> Craig Newman
 
>> ...
>> Hi all,
>> 
>> Does anyone know how to quickly get all livecode message names?
>> 
>> I know you can get the propertyNames, the functionNames, the
 commandNames
>> but I get a error when doing get the messageNames or a couple of
 similars.
> 
> Open the dictionary.
> In the left index click: Language -> Commands
> 
> Now you only need to extract this list from the first column of the
 datagrid :-)
> 
>> Thanks in advance,
>> Claudi
 
 Best
 
 Klaus
 
 --
 Klaus Major
 http://www.major-k.de
 kl...@major.on-rev.com
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 
>>> 
>>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


How to get all message names

2012-01-30 Thread Claudi Cornaz
Hi all,

Does anyone know how to quickly get all livecode message names?

I know you can get the propertyNames, the functionNames, the commandNames
but I get a error when doing get the messageNames or a couple of similars.

Thanks in advance,
   Claudi

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Duplicate Control IDs

2011-10-25 Thread Claudi Cornaz
Hi Pete,

This has happened to me several times, with a couple of different stacks.
I put it already twice on this list. Last time was in november 2010.
 
I found a routine in the IDE with a comment about the engine returning a id of 
zero sometimes. 
I found the script it in the button "revIDE" of the revLibrary stack and it's 
called "addObject" 

private command addObject pObject, pObeyDontSearch, @rList, pScriptsOnly
  if word 1 of the name of pObject is among the words of "card group field" and 
pObeyDontSearch and the dontSearch of pObject then
 return "dontSearch set on object"
  end if

  local tId
  put the long id of pObject into tId
  if word 3 of tId is 0 then
 # Due to an engine bug, some objects can have IDs of zero. For now, we 
ignore this...
 --breakpoint
  end if


Unfortunatly I haven't been able to isolate the bug in a repeatable simple way.

Because of this bug I changed my programming habbits when cloning or copying 
controls to a grp.
First I get the number of controls in the grp. Then I do the copying and then 
reference the new control by number to set it's name so I can reference the 
control afterwards by long name like:
.  
put the number of controls of grp "" into tCount
copy control "yyy" to grp "xxx"
set the name of control tCount of grp "xxx" to "myNewControl"

This way even if the conrol has a id of zero I can refence the control by long 
name.
It's a drag and defenitly should not happen. It has happened to me, and bite 
me, with versions of runrev 3.x and upwards.

The nasty bit I noticed was that using the it variable (which holds the long id 
of the newly created control) 
after the copying didn't produce a error when it contained the long id of a 
control with a id of zero.
It just screwed things up.

I sure hope, now somebody else got the same problem, this get's finaly solved.

All the best
   Claudi


On 24 okt 2011, at 19:45, Pete wrote:

> I have run into a weird situation that ends up with duplicate control IDs on
> a card which I thought couldn't happen.
> 
> The scenario is that I copy a group containing two field controls from one
> stack to a group in another stack.  After copying, the two field controls
> both have an ID of zero!  Needless to say, this plays havoc with anything I
> do that tries to access the fields.
> 
> I have worked around the problem by creating a new group, then copying the
> two fields individually from the source group to the new one and that works
> fine.
> 
> Anyone ever come across this before?
> 
> 
> Pete
> Molly's Revenge 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


SSL encryption hacked

2011-09-21 Thread Claudi Cornaz
Hi all,

I came across this article and altough I don't know much about this I thought 
it might interest some of you.
Hackers break SSL encryption used by millions of sites 

I don't know which version of SSL livecode server deploys, but apparently this 
might be something quite serious
and perhaps even a unique opportunaty for livecode server by being/becomming 
save.

Claudi
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: the objectType of me?

2011-06-26 Thread Claudi Cornaz
Hi Slava,

You can use: word 1 of the abbrev name of me
The abbrev name will return 'the type of control and the short name' like: 
button "myButton" or graphic "this grc"

   Claudi


On 26 jun 2011, at 07:00, Slava Paperno wrote:

> I'm looking for the name of the property that states the object's control
> type, e.g.
> 
> if the controlType of me is "button" then set cursor to "hand"
> 
> The term "controlType" exists only in my imagination... what is that
> property called, please?
> 
> Slava
> 
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Live LiveCode Code Event #17 - wrap-up

2011-04-13 Thread Claudi Cornaz
Hi kay,

Glad to see more and more people are playing/discovering the arduino. It's the 
new lego.

I am glad you liked the presentation and I certainly will do a follow up. I 
still have a lot more to say and show.
Heck, I hardly scratched the surface.


> WITH REFERENCE TO CLAUDI's 'MUST DOs'
> 
> I do not need to disconnect the Arduino after uploading a sketch.
I guess it depends on the particular serial driver. The UNO uses a new chip for 
the serial/usb connection so
that might explain the difference. I haven't yet tryed it with the mini pro 
which connects via a seperate usb/serial board
and uses another driver. I will test it, altough I have set it up for wireless 
communication with the xbee modules.

If anyone is interested how to get the xBee's to work, let me know. It took me 
quiete a while and a lot of frustration to get the right information. 
All I found where instruction for the old firmware and just wouldn't work.
Once I had the right info and installed a app on a windows computer I could 
configure the xbee's and now
it's realy simple to work with these wireless modules.

> My first 'read' is not 'for 1 line' but I use what I got from Sarah's
> Serial Test stack, 'read from driver tDriverName until CRLF' and to
> that I added 'in 1 ticks'. This seems to prevent LiveCode from hanging
> on the first call.
That's basicly the same, just make sure the arduino sends a CRLF. 
In my scetches I just send a 'A' char and a CR after recieving the first char, 
thats why I read for 1 line. I guess it can 
be anything as long as the amount is fixed, so it could also be for 1 char etc.
After that first "read for" I guess something in the driver routines of 
livecode get's set correctly, so afterwards
it's ok to read until empty. 

> Basically LiveCode is EXTREMELY susceptible to timing issues and there
> is a NEED to include a 'wait' command in your LiveCode loop. 
My code setup is a bit different. I always try to avoid a continues loop in my 
livecode code :-)
I know and set the samplerate with which the arduino samples and sends the 
sensor values.
Exept for that first "A" & cr I send to establish contact between the arduino 
and livecode,
everything I send from the arduino to livecode or the other way around has a 
start char "<" next a command-char, which can be any char 
but each char stands for a certain command, followed by the 'parameters' or 
'values' for the command (comma separated) and ending 
with a end char ">". Everything between "<" and ">" belangs to the same 
dataframe. (like ""
I might send a couple of dataframes from the arduino in one go, but the sensor 
samples are always spaced out in the same rythm, the samplerate.

I might send a sensor dataframe and one or more command dataframes in one go, 
but the dataframes of the sensors are always
the samplerate spaced apart. (1, 2 or 5 millisecs)
After succesfuly  opening the driver I call a routine which reads the driver 
until empty and returns complete 'dataframes'
keeping the beginning of the next dataframe if it's there already, which isn't 
completly recieved yet in a local var. 
This 'saved' partial dataframe will be put in front of the next read.
This routine calls itself in the same rythm as the samplerate of the arduino. 
This way I keep things in sync and I can still
drag the stack window around and have a responsive userinterface, so I can 
click on btns or do other things.

Even if I recieve a couple of these dataframes at a time (due to a delay in 
reading, cause I moved the window around etc.)
I know their original timing because each sensor dataframe is exactly the 
arduino samplerate appart. 
This way I can do reliable calculations of the recieved sensor values with 
regard to time.
This means I don't need a tight loop to recieve the sensor values and thus I 
don't need to experiment 
with wait in time statements.
I now send dataframes like "" every 
millisec to livecode without any problems.
I would certainly love to have to higher baudrate working. At a certain moment 
that will be the bottleneck.
You just can't push more data over to livecode as the serial connection will 
permit.
 
Currently I just finished the hardware setup with a arduino mini with a BMA180 
accellerometer and a ITG 3200 gyro
attached to the mini. The arduino mini is also connected to a xbee module to do 
wirreless communication
with livecode. I also connected a logger shield to the mini so I can record the 
accelero and gyro samples
on a SD card. So I can walk - run or skate and then analyse/visualyse all the 
data in livecode. This whole setup has the size
of a rather small remote control. A 5way switch and a RGB led are also 
connected so I can set different filters and sesitivity's
for the sensors and also to change the samplerate while in the field. (the RGB 
led is the UI. Green means I am now in the sensitivity menu 
and the number of blinks will be the number of the choice. Very primitive but 
also very small. Blue will be another menu etc.)

Re: How to send a number as a number or How to rule an LED

2011-02-06 Thread Claudi Cornaz
Tom,

There defenitly is hope. We can win that hill. It's also our's and we deserve 
to be there.

It looks like I have assembled quite a stable setup. A kind of basic framework 
which will first establish contact between 
the arduino and LC and for both sides the routines to recieve and deciever 
incomming date in any kind or form you like
and for both sides to send it out, also in any kind or form you like. 

I just came back from dinner and just to be sure I woke my iMac, Connected my 
arduino.
Switched to livecode and hit the connect button of my test stack and   ...   
...  
guess what, while typing this mail I can change the brightness of the led. (It 
get's send from the arduino
to livecode, which translates it and sends it back out to set the brightness of 
the LED)

I see in the livecode window in the background the in- and outgoing bytes roll 
by as I type. 
Heck I can change the brightness as I type. Now tomorrow, let's see how fast 
this puppy wil go.

The latest stableUseAtYourOwnRisk version is at:  
http://dl.dropbox.com/u/13685013/Arduino%20Demo.livecode

Tom, let me know if it's working for you, I sure hope so, we wouldn't want to 
loose, not on any stinking hill. 
For me, it felt more like I was in the trenches, in the dark. I sure couldn't 
have done it without a LCD screen 
connected to the arduino. Otherwise I couldn't have known where which error 
occured. There were plenty
of possibility's: in my LC code, in the communication part, or in my complete 
lack of any knowledge of c, for instance.
Guessing what happens inside a black box is nasty. At least you need some form 
of signaling to check your communication.

I guess the mothership should really fix this driver issue. 
It's very sensitive and NO MERCY at all. One little mistake and your toast. 
I have been trying so many combinations and after many, many failures I finaly 
seem to have stumbled on to a 
working incantation. 

I haven't yet realy stressed tested this formula. At the moment the arduino 
scans the sensor every 
half second. In livecode I scan the buffer every 400 millisecs. Just a tad 
quicker then the arduino.
I use a baudrate of 38400. Once I have a stable configuration I will try how 
fast we can go, but for now I now this is working
so I leave it alone.

Tomorrow I will start putting the squeeze on this configuration. I want to be 
able to control the scanning speed of the arduino
with a slider on my LC card, and also to change the repeat for the the serial 
speed in LC to see at which point the shit hits the fan.

I sure hope it will be decent. I know I won't reach the possible speeds in the 
comming weeks. I am way to clumsy in coding
but I am curious to what speeds I can caox it. 
I just keep fidling the potentiometer, to realy convince myself it's still 
working and sure as hell, it does. I guess I'll sleep like
one happy kitten tonight.

Keep you updated tomorrow, hopefully with more good news.

All the best,
   Claudi


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to send a number as a number or How to rule an LED

2011-02-06 Thread Claudi Cornaz
Hi all,

Sorry for the wrong link I posted yesterday night. ( the arduino scetch instead 
of my demo stack)
It was late and I was tired from constantly testing and crashing. Killing LC 
about 100 times in a couple of hrs. So please forgive. 
(The stack wouldn't have worked anyway something sneaked in my stack.)

So this morning I noticed the cd I was working on suddenly stopped working and 
I have been struggeling ever since.

Well any way the stack works again, I guess, though I am a bit cautious.

You can download it from: 
http://dl.dropbox.com/u/13685013/Arduino%20Demo.livecode

I can now send data to the arduino to change the brightness of a led and I can 
send commands 
to change wether the arduino needs to send sensor data to LC and from which 
sensor. ( a potentiometer or a LDR)

This data is send at the full 10 bits AD resolution so it's values can be 
between 0 and 1024. (of course it can be between 0-255 aswell)
LC recieves these values and divides them by 4 to get values between 0 and 255. 
Then this data is send back to the arduino
as brightness for the led. This works now.

A couple of important observations. 
If you open for update and you don't read periodicly LC will hang pretty 
quickly it seems. That was what bit me this morning.
A send in time didn't get executed. I just could figure out what was happening. 
since the arduino was not sending anything.
You need to empty the buffer even if the arduino isn't sending anything. This 
is crucial
I guess in that case open for writing might do the trick but if you open for 
update you NEED to read the buffer regularly!!.

Another habit I developt is disconnecting the arduino after a scatch upload. I 
pull the USB plug first before establishing contact with LC.
I don't know if it's neccesary and I will dive into this once I got a stable 
system to see if it matters but I did notice I had fewer
crashes since I do this. So this is just for what it might be worth.

Another thing I noticed when doing the write to driver is: the result will 
contain eof instead of empy. I don't know what this means but
I noticed if it didn't return eof LC would hang thereafter.

One more strange thing I notice. Sometimes altough the stack was frontmost it's 
window wouldn't show as focused,
which means the close/maximize etc. buttons would be grayed. Clicking on the 
titelbar sometimes would help for a
very short period and then go grey again. Often the titelbar would just stay 
grye what so ever. 

Well the demo is still incomplete and rough so use at own risk. The third card 
is the interesting one.
The parts that are implemented seem to work reiably now and it's been running 
for minutes withou a problem
swiching and fidling with the sensors, the LED will nicely change it's 
brightness. So Yes it looks like we are getting somewhere.
Now I need to implement the sample rate command so I can test how fast I can 
send and recieve.

Hope this proves usefull, will keep you posted

Happy coding,
   Claudi


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to send a number as a number or How to rule an LED

2011-02-05 Thread Claudi Cornaz
Tom,

Yeah, yeah, that's all certainly possible. 
At last I am getting somewhere, a relaiable connection and communication with 
the arduino with all kinds of data.

At the moment I work on a demo which has 2 sensors attached to the arduino and 
a led on the arduino

>From LC I can send data from a scrollbar to set the brightnes of the led this 
>is like ""  ( the d char to indicate it's data that follows)
I can also send "" or "" or "" to signal the arduino into switching 
to the potentiometer, the LDR or no sensor (the slider in LC get's used)
Arduino will switch to the right sensor and start sendeing it's data (this is 
the part I am working on now), or stop sending anything when it recieved ""

I also have a third command to send to the arduino like "" which means 
set the delay in the loop routine to 200 msecs. 
(so I can start playing with how often data is send to LC)

the atoi() function converts a ascci str to a integer so the str "125" gets 
converted to a integer with the value of 125

I use tDataStr[8] so I can recieve 7 bytes (1 cmd char and 6 data bytes and the 
terminating 0 char) It can be anything you like.

My code won't win a price for ellegance but I am quit proud of myself getting 
it to work. This is my first encounter with C and
I just start getting the simpelest notion of pointer arithmetic. In half a year 
my code will look a lot better I geuss.

My next try is to send values in the 10 bits precision of the AD converters to 
LC.

My demo stack is still a bit rought but you can download as it is now from: 
http://dl.dropbox.com/u/13685013/Sensor_Test.pde

As soon as I have it completly working I will upload to revOn line.
The stack has 3 cd's card 1 is a simple echo but shows how to make connection 
so LC knows it has connection
and the arduino will know aswell and enter into the loop() routine which just 
echo's what it recieves.
card 2 allows you to send some data to the arduno which again will echo the 
incomming data but now I use start and end chars
The third card is with the sensors. This is the one which iI am working on now.
I hope it will help you.

Best wishes,
 Claudi





On 5 feb 2011, at 17:37, Thomas McGrath III wrote:

> Claudi,
> 
> What is your atoi() code like? Why tDataStr[8] ? is that the number of chars 
> you can read in? can that be more?
> 
> What if we want to send "<13-125>" can we parse that to separate out the 13 
> for Pin 13 and the 125 for brightness?
> 
> What about "<13-1-125>" and "<13-0-1>" for pin 13 output 125 and 13 input 
> read once 1 or / continuos 0. etc.
> 
> 
> -- Tom McGrath III
> http://lazyriver.on-rev.com
> 3mcgr...@comcast.net
> 
> On Feb 5, 2011, at 7:19 AM, Claudi Cornaz wrote:
> 
>> Hi tom,
>> 
>> I am working with the same. What I undersrtand and have found on forums etc
>> you need to use atoi() to convert from type char to int.
>> You send out 3 chars when sending for instance, 125.
>> The arduino seial.read routine will fetch 3 chars (125)
>> 
>> I use a startChar 1 or more data chars and then a stopChar like "<125>"
>> This is what I send to the arduino
>> Then on the arduino I do serial.read() till I recieve a "<" char.
>> As soon as I have "<" I start gathering the bytes in a char tDataStr[8] var 
>> till I see a ">" char. Now I convert this char tDataStr to a int with atoi()
>> int tDataInt;
>> tDataInt = atoi(tDataStr);   // now I have a int which I can pass as value 
>> to 
>> analogWrite(ledPin, tDataInt);
>> 
>> At least this is how it is recommended on the forums.
>> 
>> I almost got this working.
>> By the way I also noticed the following
>> Use open driver "xxx" for text update  -- same as you
>> 
>> then the first read you do should be in a "for 1 line" or "for x chars"
>> Once this first read is done with the "for xx" form it looks like something 
>> in LC gets initialized right
>> so subsequent reads can be until empty. 
>> 
>> I am still trying to figure this out more precisly and some real stress 
>> testing as soon as I have 
>> a demo working which involves sending sensor values from the arduino to LC 
>> and vice versa
>> I am almost there. Still struggeling with some C code, but slowly getting 
>> the hang of C)
>> 
>> I hope to have a nice demo this weekend and will upload it to revOnline once 
>> it's working like I want it to.
>> 
>> 
>> Best wishes,
>> 
>>  Claudi
>> 
>> 
>> 
>> 
>> 
>> On 4 feb 2011, at

Re: How to send a number as a number or How to rule an LED

2011-02-05 Thread Claudi Cornaz
Hi tom,

I am working with the same. What I undersrtand and have found on forums etc
you need to use atoi() to convert from type char to int.
You send out 3 chars when sending for instance, 125.
The arduino seial.read routine will fetch 3 chars (125)

I use a startChar 1 or more data chars and then a stopChar like "<125>"
This is what I send to the arduino
Then on the arduino I do serial.read() till I recieve a "<" char.
As soon as I have "<" I start gathering the bytes in a char tDataStr[8] var 
till I see a ">" char. Now I convert this char tDataStr to a int with atoi()
int tDataInt;
tDataInt = atoi(tDataStr);   // now I have a int which I can pass as value to 
analogWrite(ledPin, tDataInt);

At least this is how it is recommended on the forums.

I almost got this working.
By the way I also noticed the following
Use open driver "xxx" for text update  -- same as you

then the first read you do should be in a "for 1 line" or "for x chars"
Once this first read is done with the "for xx" form it looks like something in 
LC gets initialized right
so subsequent reads can be until empty. 

I am still trying to figure this out more precisly and some real stress testing 
as soon as I have 
a demo working which involves sending sensor values from the arduino to LC and 
vice versa
I am almost there. Still struggeling with some C code, but slowly getting the 
hang of C)
 
I hope to have a nice demo this weekend and will upload it to revOnline once 
it's working like I want it to.


Best wishes,

   Claudi





On 4 feb 2011, at 17:22, Thomas McGrath III wrote:

> I am having a problem communicating with an LED. (Never thought I'd hear 
> myself say that!)
> 
> I have code in LC in a slider:
> -- We are open driver ... for text update
> on mouseUp
>put the thumbPosition of me into tValue
>doUpdate(tValue)
> end mouseUp
> on doUpdate tValue
>put gThePort into thePort -- global port "/dev/cu.usbmodem1a21"
>read from file thePort until empty -- clear the buffer
>put it into field "Data" -- just to see what garbage is left over - not 
> needed
>wait 30
>write tValue to file thePort -- Vaule is 0 -255 as per the Analog specs of 
> a PWM on the Arduino Uno for an LED
>read from file thePort until empty -- Arduino is set to send back the data 
> received this is so I can see it
>put it after field "Data"
>if the result is not empty then put the result into field "Results" -- 
> gives us our eof
> end doUpdate
> 
> I send out a 125 but I get back three lines:
> 1
> 2
> 5
> but the analogWrite is looking for 125
> 
> void loop() {
>  // check if data has been sent from the computer:
>  if (Serial.available()) {
>// read the most recent byte (which will be from 0 to 255):
>char received = Serial.read();
> 
>// set the brightness of the LED:
>analogWrite(ledPin, received);
>Serial.println(received);
>  }
> }
> 
> If I change the Serial.println to Serial.println(received, BYTE); I still get:
> 1
> 2
> 5
> But if I change it to Serial.println(received, DEC); I get these results:
> 49
> 50
> 53
> 
> So How do I send a number as a number and not as single digits?
> 
> 
> -- Tom McGrath III
> http://lazyriver.on-rev.com
> 3mcgr...@comcast.net
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: usb driver problem

2011-01-27 Thread Claudi Cornaz
Hi all yea,

17.23 CET. Finaly we have contact

12345678
   /1296144957195
12345678
   /1296144957802
12345678
   /1296144958107
12345678
   /1296144958412
12345678
   /1296144959018
12345678
   /1296144959322
12345678
   /1296144959629

data kept on comming. Now I knew there was life outthere. WE finaly had contact.

Marks mail set me thinking.
>  Well, from a quick look at things, I'd say you started a script that
> did a "repeat until EOF" and LC crashed trying to allocate memory
> space for the read. That is Not a Good Thing.

Well I didn't have a repeat loop in my code, so where could it be.
I had used read from driver "xxx" until end. I had somewhere read in the 
dictionairi to use the "until end" part for serial ports. There is on the other 
hand another form to read the driver which is like"  "for x" . Like read for 3  
(read 3 chars) or read for 1 line  etc. This gives the exact number of bytes to 
read. No loop or repeat is required. There is a specific offset, whereas the 
"until x" form most likely will use a repeat loop some where in it's code. 
probably that's the culprit. 
Well there is a bit more going on. Uptill now I have found one "mAGIc"  form 
which seems to work on OS 10.5 and 10.6 in a stable manner. This means I can 
drag the window 
around and LC still responds to clicks in the way it should,instantaniously.

step one, open the connection with: 
open driver "/dev/cu.usbmodemxxx" text for update -- xx is the version of 
driver that was installed. 
 -- don't use binary since it will hang LC, at least it did on, I beliefe, both 
of my systems. 
 -- use update for 2 way communication.

then use a send in time form to see if there's data. As far as I know there 
isn't a serialAvailable kind of thingy so just read the serial port and see if 
you got something. Do this like:

on serialRead
   read from driver "/dev/cu.usbmodem3d11" for 1 line  -- the arduino 
scetch repeatly sends Serial.println("12345678")  with a cr with each send
   -- or 8 (chars) or something similar. [see dictionary and try at your 
personal risk]
   if it <> "" then
  -- ok we have some data. for now put it into a field. 
  put it & "   /   " & the millisecs into fld "recieved"  
   end if

   send serialRead to me in 20 
end serialRead

If you use a "until end | eof | empty" instead of read from driver 
"/dev/cu.usbmodem3d11" for 1 line 
LC will choke and in my case a hard crash.

There is a second problem solved aswell. I was able to send 1 char at a time 
with 10.5. I wasn't able to send more chars at a time.
The strange thing was I needed to send out a char before I would see anything 
returned. As soon as a char was send the input buffer 
was read and I saw suddenly quite some data in one go. This also happened when 
I send 2 or more chars from the arduino but then 
LC would hang and dye. Probably the first time the serialRead cal got invoked 
with the "until x" form something in the engine became 
a bit upset, which wasn't to bad as long as it only recieved a char at the 
time. With 2 chars at the time or worse even more, it just blew. 
It couldn't cope anymore. It just needs to get ver specific instructions 
otherwise it just spaces out on all posi bi   lity's.
Anyway as I was saying, once I used the "for x" form as soon as I opend the 
driver data started streaming in like at the beginning of this mail. 
I still have to do some more testing because in my tests I also found some kind 
of intermittend forms. The data kept comming in but LC had becom unresponsif. 
I couldn't move my window around or click on buttons etc. This forced me to 
force quit. So although I haven't figured it all out yet, this seems very 
promissing 
and I will upload my test stack to revOnline as soon as I have it a bit decent. 
I hope this turns out to be a universal solution, for now at least. I believe 
these driver/file commands need a tune up. 
I guess it would be a good thing for me to do, is to add a comment in the 
dictionary

I will do some more testing but It looks like there is a workourand and we can 
all start using the fascinating world of micro conrollers.
For me this is very funny. I started out prying open / cq smashing valves as a 
young kid. Then I started playing with transistors, building 
all kinds of stuff. Then came the first logic chips. AND OR EXOR multivabrator, 
clocks, dividers. This became some kind of new lego for me. 
I could build all kinds of stuff with these building blocks. I devised my own 
cheap mans universal mega breadboard sometime in the 70's. 
It was a graet system. Take a wooden plank about 80cm X 35 cm and make a lot of 
little circuitboards which can hold one IC socked and 
have little strips of copper pointing outwards. The sockets were mounted so the 
copper would be facing up. Wherever you needed a some logic 
just screw one of these little circuit boards in the plank and solder wires to 
connected to the other ic. I made a system 

Re: usb driver problem

2011-01-26 Thread Claudi Cornaz
Hi all,

Opening and closing the port after each read has a critical drawback. Each time 
you open the port, at least on mac, 
the arduino will reset itself, this means it will bootup. This not only takes 
time but all other data will be lost.
This of course creates a big problem, or makes it completly impossible to use 
for most applications, 
certainly for what I am trying to do.

I am further testing this and here are some "interesting" observation when 
using the arduino with OS 10.5

setUp:
The arduino executes a repeat loop in which it sends a "1" every 300 millisecs 
out of it's serial port  (9600 baud)

In LC I have a routine which reads from driver "/dev/cu.usbmodem3d11" untill 
end every 200 milisecs
 and places a cr and this recieved data after my "recievedData" field. This 
means each read will be on it's own line.

When I open the port in LC I seem to recieve nothing. First I have to send a 
char to the arduino and then I recieve the "1"'s
the arduino sends.  
Question: why would it be neccesary to first send something in order to be able 
to recieve?

Once I send a char to the arduino I start to see my recieved data starting with 
a bunch of "1"'s 
on one line and then it fills up with just one "1" on each line.
This means the first read empty's the buffer which had been accumulating till I 
send out a char, to be able to recieve.
The driver was already recieving and putting the data in the buffer but LC 
somehow was not able to read the driver untill at least one char was send out.

As long as the arduino is sending a char at a time, once started recieveing, LC 
keeps on recieving without a problem. The moment I drag my stack around and let 
go I see a couple of "1" on one line again. 
My send in time routine which does the reading apperently didn't get called 
during the dragging 
so the data accumulated again in the buffer and was later read in one go. 
The longer I drag the stack around the more "1" I will see on the same line. 
Ok so the buffer can accumulate data and subsequently LC can read the whole 
bunch in one read call.
I can let the buffer fillup quite substantialy by waiting to send a char after 
opening the driver or 
by draging the stack around for quite a while. (At least 20 char's can 
accumulate in the buffer, no problem) 

The moment I let the arduino send out to chars like "12" it first seems to be 
ok, but after about 3 sec. LC unexpectitly quits.

I have made a copy of the crash report to see if there is some info in it. 
Perhaps one of the guru's on this list
knows how to interpret this info and give some usefull suggestion. I certainly 
hope so. 
Arduino and LC seems like a winning ticket to me, which would open up a 
tremendous amount of possibility's. 

All the best,
   Claudi



The crash report:

Model: MacBook2,1, BootROM MB21.00A5.B07, 2 processors, Intel Core 2 Duo, 2.16 
GHz, 2 GB
Graphics: kHW_IntelGMA950Item, GMA 950, spdisplays_builtin, 
spdisplays_integrated_vram
Memory Module: global_name
AirPort: spairport_wireless_card_type_airport_extreme (0x168C, 0x87), 1.4.16.2
Bluetooth: Version 2.1.9f10, 2 service, 1 devices, 1 incoming serial ports
Network Service: Built-in Ethernet, Ethernet, en0
Serial ATA Device: WDC WD2500BEVS-00UST0, 232,89 GB
Parallel ATA Device: MATSHITADVD-R   UJ-857E
USB Device: Built-in iSight, (null) mA
USB Device: Bluetooth USB Host Controller, (null) mA
USB Device: IR Receiver, (null) mA
USB Device: Arduino Uno, (null) mA
USB Device: Apple Internal Keyboard / Trackpad, (null) mA
USB Device: composite_device, (null) mA

---
Process: Revolution [7510]
Path:/Users/ccM/ Programming/LiveCode 
4.5.2.app/Contents/MacOS/Revolution
Identifier:  com.runrev.livecode
Version: 4.5.2.1150 (4.5.2.1150)
Code Type:   X86 (Native)
Parent Process:  launchd [135]

Interval Since Last Report:  6490879 sec
Crashes Since Last Report:   22
Per-App Interval Since Last Report:  236466 sec
Per-App Crashes Since Last Report:   19

Date/Time:   2011-01-26 11:23:30.273 +0100
OS Version:  Mac OS X 10.5.8 (9L31a)
Report Version:  6
Anonymous UUID:  82304991-EAC9-455C-9B80-3ADCCD1FFE0A

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x, 0x
Crashed Thread:  0

Thread 0 Crashed:
0   libSystem.B.dylib   0x91ddde42 __kill + 10
1   libSystem.B.dylib   0x91e5023a raise + 26
2   libSystem.B.dylib   0x91e5c622 __abort + 97
3   libSystem.B.dylib   0x91e5c68a _cproc_fork_child + 0
4   libstdc++.6.dylib   0x92049005 0x92001000 + 294917
5   libstdc++.6.dylib   0x9204710c __gxx_personality_v0 + 1108
6   libstdc++.6.dylib   0x9204714b std::terminate() + 29
7   libstdc++.6.dylib   0x92047261 __cxa_throw + 101
8   libstdc++.6.dylib   0x920475d8 operator new(unsigned long) 
+ 100
9   libstdc++.6.dylib   0x92047689 ope

Re: usb driver problem

2011-01-23 Thread Claudi Cornaz

Anybody know where to look for the crash log of LC? 
Perhaps this might give a clue. I opened up console but didn't find the 
relevant part to look.

Best wishes,
   Claudi


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: usb driver problem

2011-01-23 Thread Claudi Cornaz
Hello all,

It's good to see this thread is picking up some steam, because this could realy 
be something LC could shine in.
A easy and powerful environment to control all things around us, motors, 
sensors, solarpanels, your thermostat, you name it, the sky is the limit.

Ok, it's getting strange now. On my macbook with os 10.5.8 and my test stack 
sending and the aduino echoing all goes well, more or less.
Now I uploaded a scetch where the arduino does the sending all on it's own with:
 Serial.print,("Hello world");
 Serial.print("some more");
 delay(300);

I seem to recieve nothing. No I send something and suddenly I see a lot of 
"hello world some more" and then livecode freezes up and crashes hard.
It just quits. So there defenitly seems to be a problem with LC. I even tryed a 
try clause around the recieving code but no avail what soever.
It's just a hard crash. LC 4.5.3,LC 4.5.2 and LC 4.5.1

Now I changed the arduino scetch a bit and it does just  
Serial.print("1");

Now initialy I don't seem to recieve anything (using read from driver send at 
regular intervals)
Next I send a char to the arduino and suddenly I recieve a lot of one's 
first there are a lot on one line ( each succesive read is on a new line so 
these were in the buffer and read in one go)
then some 1 on one line and sometimes there are two 1 on one line.  ( I  scan 
the input each half sec's and send every 300 millisecs so this looks ok)

This raises at least 2 questions:
1. Why do I need a send at least one char before I can recieve?
2. Why does LC crash when I do?
  Serial.print,("Hello world");
  Serial.print("some more");

After a bit more expirimentation I discovered that I can send up to "hello " 
chars and all works fine with 10.5.8
one char more and troubles start, LC crashes. 
Well it's a bit more complex. I now send "hello" every 300 millisecs. In LC I 
read the port every sec ( to build up in the buffer). So as soon as I send a 
char to start recieving ( I know this is strange but somehow needs to be done) 
I recieve a lot of hello's as one block then they trickle in but very soon LC 
will just crash hard.

I'll do some more sleuthing and post the results as soon as I have some time. 
LC just crashes all the while after recieving now.
I think I need some sleep. It just drives me crazy.

This seems to me a big problem  'cause LC could be a great environment just for 
this kind of stuff. Specialy with the firmata project
of arduino which, if I understand it correctly will allow people to use the 
arduino without need to learn to programming the thing. 
It will just expose/make accesible all the pins of the ardiuino to the 
environment like LC. This means you can configuer each pin 
and read and write to each pin on the arduino completly from within LC. No 
programming of the arduino required
A great opportunity which could open up  a exciting new world: interaction with 
the outer world without learning a new language.
LC realy should not just crash and dye on us in this horribly way when reading 
from a driver or file as serial port.

Another question: where are these drivers installed on my disk? Perhaps I could 
swap the 10.5/x version with the 10.6.x version to see if that
will help. No idea but I am willing to try anything. (When installing choosing 
custom I can see there are 2 different drivers but one is always greyed
out. A different one is greyed out for 10.5.x and 10.6.x) I read somewhere 
there is also some kex file or something like that. Anyone any idea's?


Lots of succes,
   Claudi



On 23 jan 2011, at 22:57, Jerry J wrote:

> On Jan 23, 2011, at 7:09 AM, Thomas McGrath III wrote:
> 
>> Jerry,
>> 
>> Maybe you can answer this? The Arduino ide prefers to use the cu.usbmodem* 
>> and some of the tests I have done in LC have shown that the tty.usbmodem* is 
>> the better choice for receiving data from the Arduino Uno and the 
>> cu.usbmodem* when trying to send. I am not sure what the difference between 
>> the two of them are and why LC prefers the tty for receiving and the cu for 
>> sending??? And my test are suspect to begin with due to a lack of 
>> understanding at the start into this wonderful world  of serial 
>> communications.
> 
> I don't have much experience with UNIX drivers, or how they're named. I can 
> guess what tty is short for, but no clue about cu. As for the chars at the 
> end (like 3d11 or 3a21) are those identifiers assigned by UNIX to be sure 
> each driver is unique? I know that happens with disk names, but its just a 
> guess here. Over to you, UNIX guts gurus!
> 
> --Jerry
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe

Re: usb driver problem

2011-01-23 Thread Claudi Cornaz
Tom and all,

 I have made a test stack which I now use to test my connections with the 
arduino board.

The sketch just echo's what it recieves back out with a delay of 500 millisecs. 
(It's included with the stack)

you can download the stack from:  
http://dl.dropbox.com/u/13685013/arduino%20tester.livecode

I have this working with my macbook OS 10.5.8/livecode 4.5.2 build 1150 
  /   arduino uno 0022   driver: /dev/cu.usbmodem3d11
I seems it's working partly with my iMac OS 10.6.6/   livecode 4.5.1  build 
1130   / arduino uno 0022   driver: /dev/cu.usbmodem3a21
   (sending seems ok. The arduino reacts by transmitting, I can see the tx led 
flash, but I can't seem to recieve.

The first thing I will do is to update livecode on my iMac to see what's gonna 
change I guess.

I'll post the results

I hope this stack will prove usefull.
I am curious what works for you. If you have any questions, feel free to 
contact me.

Succes,
Claudi
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: usb driver problem

2011-01-23 Thread Claudi Cornaz
Tom and all,

What I have found about these settings is the baudrate of course and then 8 
databits 1 stopbit no parity. That's it.

I have found this info in the pref file of the arduino IDE, which is in the 
users library/Arduino folder.
I have now connected a LCD screen and keypad to my arduino to get some more 
feedback I hope to what I am doing
and I am writing a simple test stack/scetch combo to do the further sleuthing. 
As soon as I have this finished/working I will post both
so you can try it. I hope I can manage to do it today.

Tom which version of OSX are you using, since with 10.5 I can send and recieve 
in livecode but alas with 10.6 not yet.
I use: constant kSerialSettings = "BAUD=9600 PARITY=N DATA=8 STOP=1" for the 
serial settings

I have no idea yet what changed between 10.5 and 10.6 and wether that's the 
change or that there is a difference
in the installed usb/serial driver. With 10.5 the  /dev/cu.usbmodem3d11 driver 
gets installed
and with 10.6 it's the/dev/cu.usbmodem3a21  driver. So depending on the os 
version there is a different driver
and the problem might be in that driver.

Best wishes,
   Claudi





___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: usb driver problem

2011-01-21 Thread Claudi Cornaz

Tom,

Which version combination are you using?

Best wishes,
 Claudi

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: usb driver problem

2011-01-21 Thread Claudi Cornaz


I just realize it's not only the os version that's different. My macbook has a 
older version of livecode aswell.
Some more sleuthing to do.
First thing, sometime tomorrow or this weekend.
Keep you posted.

Best wishes,
   Claudi
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: usb driver problem

2011-01-21 Thread Claudi Cornaz
Tom,

At the moment I got it working with my laptop with OS 10.5.8
I can send and recieve with livecode using open driver "/dev/cu.usbmodem3d11"
I use the arduino 0022.dmg 

There is still something weird going on with a buffer or so. With the first 
send I do 
and even waiting after the send for 1 sec before doing the read I get empty. 
Then with the next send/recieve I recieve the previous data. I am always one 
datacycle behind 
with the read. Ok this should be solvable one way or another.

Unfortunatly I haven't been able to duplicate this with my iMac with OS 10.6.6
I believe the sending part works 'cause when I send the string "123456" and the 
board echo's
what it recieves I see the tx led flash 6 times (6 chars) this is the same when 
doing this with my laptop.
So it looks like the board gets the data from livecode but I don't seem to be 
able to read it right with livecode.

Still it looks promissing so far.

Best wishes,
   Claudi
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: usb driver problem

2011-01-21 Thread Claudi Cornaz
Hi Thomas,

Well, I recieved my arduino yesterday and started experimenting. I can upload a 
scetch to the board and it functions well.
I can also communicate with it via ZTerm. (send and recieve)

Now the most important part: communicating with it via livecode.
Alas this gives me trouble aswell. Here is what I got.

Using Mark's code from the makeboard to get the OSXDeviceNames() and with the 
arduino connected I see the following:
(it's important to have the board connected otherwise I don't see those modems)

usbmodem3a21
/dev/tty.usbmodem3a21
/dev/cu.usbmodem3a21
Bluetooth-PDA-Sync
/dev/tty.Bluetooth-PDA-Sync
.   ..
etc.

Further I can open a driver with: open driver "/dev/cu.usbmodem3a21" 
and see a result on the board, it's resetting (as in the manual so this is as 
should be)
I can also close the driver.
I haven't been able to recieve data from the board, but I am able to send 
something to the board.
I send it a 1 and on the board I have a scetch which checks if it recieves 
data. If it recieves data,
it will send the same data out with a delay of 500 millis. So when I send data 
from livecode
I see the Rx led light and thereafter I see the Tx light, which means the board 
did recieve something and sends
the incomming data back out.
Now I am gonna try to figure out what it recieves and what it sends. (Probably 
I am gonna hook the whole bit up to a scope
so I can see what's going on on a electrical level)

If I use open file instead of driver it doesn't work. If I use the 
/dev/tty.usbmodem3a21 instead of  /dev/cu.usbmodem3a21
livecode hangs with the beachball and I have to force quit.

Well that's as far as I got till now.
Perhaps it would be a good idea to discuss/collaborate some of our 
effords/failings etc. offlist.
As soon as I have something more I will contact you. Feel free to mail me with 
your addional results/questions/suggestions etc.


Best wishes,
Claudi




On 21 jan 2011, at 07:19, Thomas McGrath III wrote:

> Actually, as long as data is coming from the Arduino the app works. The data 
> comes in and fills the field. But after the data stops being sent the system 
> hangs. Until I push the button on the Arduino to send more data in which case 
> the beach ball goes away and the new data gets received again.
> 
> It's like as long as data keeps everything is fine. I can even close the port 
> in the middle of getting data but If it gets to the end of the current stream 
> the system hangs and I can't even close the port. I put code in to close the 
> port after data stops and that is working I think but the system still hangs 
> like it's waiting for more.
> 
> 
> -- Tom McGrath III
> http://lazyriver.on-rev.com
> 3mcgr...@comcast.net
> 
> On Jan 21, 2011, at 1:12 AM, Thomas McGrath III wrote:
> 
>> OK well I can read the data from the USB Serial Modem -- but -- after it is 
>> done the app hangs. 
>> 
>> So I can open the port and then read the port and I think close the port but 
>> the system hangs.
>> 
>> HELP ??
>> -- Tom McGrath III
>> http://lazyriver.on-rev.com
>> 3mcgr...@comcast.net
>> 
>> On Jan 21, 2011, at 12:48 AM, Thomas McGrath III wrote:
>> 
>>> It seems if I set the EOL to CRLF things work partly. i.e. The numbers show 
>>> up in the field BUT the script keeps looping and will not stop causing the 
>>> beach ball.
>>> 
>>> Sarah's code:
>>> on readPort
>>> if the hilite of btn "Port open" = true then
>>> 
>>>  if recEOL is "empty" then resetEOL
>>> 
>>>  put the label of btn "Port" into thePort
>>>  if the hilite of btn "OS X" then
>>>read from file thePort until recEOL
>>>  else
>>>read from file thePort until recEOL
>>>  end if
>>>  if it is not empty then put it after fld "recField"
>>>  if last char of fld "recField" <> cr then put cr after fld "recField"
>>>  send readPort to me in 5 ticks
>>> end if
>>> end readPort
>>> 
>>> 
>>> 
>>> -- Tom McGrath III
>>> http://lazyriver.on-rev.com
>>> 3mcgr...@comcast.net
>>> 
>>> On Jan 21, 2011, at 12:05 AM, Thomas McGrath III wrote:
>>> 
 UPDATE: Something is working but makes no sense.
 
 Found a few terminal screen ideas but they are outside of Livecode. No 
 good.
 Found a few applescript examples but would rather keep this crossplatform 
 if possible and a LC to OSC solution would work on iOS but applescript 
 would not. Not best but may have to go this route.
 
 Found a few softwares that access the USB modem (not FTDI serial 
 emulation) as serial which leads me to believe LC can still do this even 
 with the change from software emulation of a serial port to the hardware 
 emulation of a serial port. So I looked again at Sarah's serialTest stack.
 
 I had to manually add the /dev/tty.usbmodem1a21 and /dev/cu.usbmodem1a21 
 to the popup menu. Then find replace driver with file in five places in 
 the stack. Now most of the other solutions use the tty but two use the cu 
 so I tested both. Major hang and LC not respond

Re: usb driver problem

2011-01-18 Thread Claudi Cornaz
Hi Thomas,

I just ordered a arduino yesterday and hope to have it tommorow.
I sure hope this can be solved. (Well I am very positive about that, one way or 
another, that's why I ordered one anyway)

I have been looking on the web. I guess you did this already but just in case, 
here are some links
http://www.patokeefe.com/archives/316
http://ricardo-dias.com/node/130
http://code.google.com/p/xcode-arduino-serial-communication/

and in the livecode forum there is a thread about the arduino and apparently 
mmiele got it working :

by mmiele » Sat Dec 06, 2008 10:25 am

I used MacOS Tiger and then Leopard. 

What you need is: 

1 - download and install from the Arduino site (http://www.arduino.cc) the 
Arduino SDK. 

2 - download and install from the Arduino site or the FTDI site 
(http://www.ftdichip.com) the driver to see the Arduino USB as a serial port. 

3 - connect the arduino board to an USB port of your Mac. 

You will see is a new entry in the list of serial devices. 
You can get the list reading the "driverNames" property: ex. 

put the driverNames into field "serialPorts". 

You can get a useful stack to test serial communication at 

http://www.troz.net/Rev/tutorials.php 

The stack is SerialTest.rev
mmiele
 
Posts: 17
Joined: Sun Jan 21, 2007 12:25 pm
Location: Naples, Italy


this is from: http://forums.runrev.com/phpBB2/viewtopic.php?f=14&t=2419

I hope you can get it working quickly and otherwise I will join your efford as 
soon as my arduino arrives.


Best wishes,
   Claudi
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode