This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#26 2009-04-17 02:14:53

ManaUser
Scratcher
Registered: 2009-03-11
Posts: 100+

Re: Remote Sensor Connections in v1.3

I just found this and I have a couple of questions.

Is there a known bug with opening a new project while using remote sensor connections? It seems to break the socket connection somehow, but without actually closing it. Anyway, no more data gets through. Or is it just me?

Is it possible to make boolean remote sensor values? (So they show up in <sensor ____ ?> block.)


http://i.imgur.com/SPYSM.gif http://i.imgur.com/t9k1Z.gif http://i.imgur.com/OwYVa.gif http://i.imgur.com/0qlZq.gif

Offline

 

#27 2009-04-17 11:48:11

chalkmarrow
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: Remote Sensor Connections in v1.3

ManaUser wrote:

I just found this and I have a couple of questions.

Is there a known bug with opening a new project while using remote sensor connections? It seems to break the socket connection somehow, but without actually closing it. Anyway, no more data gets through. Or is it just me?

Is it possible to make boolean remote sensor values? (So they show up in <sensor ____ ?> block.)

Yeah. Opening a new project breaks the connection, though I didn't know that the socket wasn't closed. Could be a bug. I think v1.4 might address this.

Offline

 

#28 2009-04-17 12:08:30

DsGameMaker
Scratcher
Registered: 2009-04-14
Posts: 89

Re: Remote Sensor Connections in v1.3

I want to get a pictoboard.

Offline

 

#29 2009-05-07 19:11:55

sburlappp
Scratcher
Registered: 2009-05-07
Posts: 2

Re: Remote Sensor Connections in v1.3

DsGameMaker wrote:

I want to get a pictoboard.

You can emulate a PicoBoard / ScratchBoard with an Arduino, it will work fine in Presentation Mode, and you can even connect a Wii Nunchuck directly to it:

http://scratchconnections.wik.is/User:Sburlappp/Emulating_a_ScratchBoard_with_an_Arduino

Offline

 

#30 2009-05-17 15:28:54

SonicMariofan
Scratcher
Registered: 2008-04-26
Posts: 99

Re: Remote Sensor Connections in v1.3

Is there a version of the Wii2Scratch program for mac?

Offline

 

#31 2009-06-10 16:02:00

filo5
Scratcher
Registered: 2008-01-08
Posts: 1000+

Re: Remote Sensor Connections in v1.3

To SonicMariofan: Java runs on every platform which supports Java VM, so you can try to compile it for yourself.

To main topic: What's with those features in 1.4 RC? Are they improved a bit (e.g. running in fullscreen mode or something) or not?


Converting my Scratch projects to Python!

Offline

 

#32 2009-06-14 07:45:34

iwansuryo
Scratcher
Registered: 2008-05-16
Posts: 29

Re: Remote Sensor Connections in v1.3

I don't know where to ask, maybe in this thread. Is there a chance to drive motor of GoGoBoard or Arduino from within Scratch? Or maybe this is can be done with Scratch 1.4? Anybody have experience to do this? Thanks for your answer.

Iwan S.

Offline

 

#33 2009-06-15 00:27:56

chalkmarrow
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: Remote Sensor Connections in v1.3

iwansuryo wrote:

I don't know where to ask, maybe in this thread. Is there a chance to drive motor of GoGoBoard or Arduino from within Scratch? Or maybe this is can be done with Scratch 1.4? Anybody have experience to do this? Thanks for your answer.

Iwan S.

I think so. Check out this thread re the GoGo board:

http://scratch.mit.edu/forums/viewtopic.php?id=11672

Offline

 

#34 2009-06-16 13:34:05

fongshek
Scratcher
Registered: 2009-06-05
Posts: 1

Re: Remote Sensor Connections in v1.3

I wrote a PC software which simulate the scratch Board on PC.
http://scratchconnections.wik.is/User:Fm/Zion_Plug
so you can start develop scratch program which interact with
scratch board without buying any hardware.

The ZionPlug also support Digital Output device such as
PWM, UART and Boolean Digital Output and Input.

I modified an atmel AVR test board which can provide those additional digital IO

Offline

 

#35 2009-06-18 02:34:52

iwansuryo
Scratcher
Registered: 2008-05-16
Posts: 29

Re: Remote Sensor Connections in v1.3

Are you creating Zion Board by yourself? Are you selling it or make it open source? Why you don't give any explanation about it?

Iwansuryo

Offline

 

#36 2009-09-05 08:14:31

filo5
Scratcher
Registered: 2008-01-08
Posts: 1000+

Re: Remote Sensor Connections in v1.3

Can anyone help me with preparing this size field of message? I'm a C# .NET programmer.

Get the string size for Scratch:

Code:

        private byte[] getScratchSize(int messageStringLength)
        {
            byte[] a = { 0, 0, 0, 0 };
            a = BitConverter.GetBytes(messageStringLength);
            return a;
        }

Main sending method (I have them for float and string too):

Code:

        public void sensorUpdate(string name, int value)
        {
            string outstring = "sensor-update \"" + name + "\" " + value.ToString();
            try
            {
                strWrite.WriteLine(getScratchSize(outstring.Length));
                strWrite.WriteLine(outstring);
            }
            catch (Exception e)
            {
                Form1.aMessageBox("Cannot send message. Reason:\n\n" + e.Message);
            }
        }

Converting my Scratch projects to Python!

Offline

 

#37 2009-10-17 03:40:53

paulpanther
Scratcher
Registered: 2009-09-17
Posts: 4

Re: Remote Sensor Connections in v1.3

Hi ChalkMarrow,

you wrote a very interesting tool but it does not work for me  :-(

chalkmarrow wrote:

A Processing program that allows simple communication between Scratch and an Arduino board is available at:

http://scratchconnections.wik.is/User:Chalkmarrow/Catenary

Yes, it's a rather old discussion but nice tools should work also some versions later.

I installed Scratch 1.4 and your Cantenary. I enabled the remote sensor connections in Scratch. Scratch and Cantenary are communicating ... I can see the high and low bits in the Cantenary window.

The problem is that Cantenary does not communicate with my Arduino. Could it be that there is a new version of Arduino with an ATmega328 that does not work with the current software?

Is it possible for someone in this forum to tell me what I should try to do? I want to get the Arduino with Scratch and I also want to try the ScratchBoard emulation.

http://scratchconnections.wik.is/User:Chalkmarrow/Catenary
http://scratchconnections.wik.is/User:Sburlappp/Emulating_a_ScratchBoard_with_an_Arduino

Best regards, Ralf

Offline

 

#38 2009-10-17 13:02:49

chalkmarrow
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: Remote Sensor Connections in v1.3

paulpanther:

Unfortunately, Catenary will only work with v1.3 right now, since the way variables are sent over a remote connection changed quite a bit with v1.4. I plan to work on a new version eventually when I get some time. Hopefully in the next month or so...

Offline

 

#39 2009-10-22 01:51:53

DaveK2
Scratcher
Registered: 2009-08-21
Posts: 2

Re: Remote Sensor Connections in v1.3

I have posted a link on the ScratchConnections project page to 'HyperCos' a Catenary work-alike written in Delphi 7. I wrote it mostly as an example demonstrating how to interact with the Arduino from Delphi. It is currently working with Scratch 1.4.

Since I wrote it as an instructional tool for Delphi programmers I haven't written any documentation about how to use it from Scratch. However, the included Scratch project covers most of the commands.

Comments and suggestions welcome, and thanks to chalkmarrow for Catenary, which I've shamelessly cribbed off of for ideas.

Offline

 

#40 2009-10-22 20:20:26

chalkmarrow
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: Remote Sensor Connections in v1.3

DaveK2:

Looks great! Nice job. I've always been interested in Delphi, though I never spent the time to learn it. I'll play around with it this weekend with one of my boards. I'm really glad someone wrote an Arduino bridge that is compatible with 1.4. I've been a bit busy to fix the current, broken version...

- chalkmarrow

Offline

 

#41 2009-10-30 18:40:58

itsme213
Scratcher
Registered: 2007-07-08
Posts: 38

Re: Remote Sensor Connections in v1.3

DaveK2:

Any chance you could post a very short writeup on the scratch usage, either here or on the GoogleCode or Scratch Connections page? Just basic things like what the different elements of

  ^ pinmode 14 AnalogIn

mean, or particular things to watch out for.

Do you think it is ready for use by others? My purchase decision on an Arduino board rides on this ...  :-) 

Can you please suggest which (basic) board to get, and from which source?

Lastly ... while I do have PC with XP and will first try it on that, I'd like to eventually do this on a Mac, perhaps under VMWare but preferably compiled native. Does the Delphi part do UI and other tricky cross-platform stuff, or is it likely to compile for Mac under something like FreePascal http://www.freepascal.org/ ?

Thanks!!

Sophie

Offline

 

#42 2009-12-07 07:28:17

touch_classroom
Scratcher
Registered: 2009-09-28
Posts: 25

Re: Remote Sensor Connections in v1.3

Hi! I try to follow the instruction of Scratch Connections website and write a python program for sending LEGO NXT sensors reading to Scratch project through "Remote Sensor".

It works when I open a new Scratch program and run my python program, I can write scripts, Scratch receive data from python program normaly.

When I save the scratch project and try to open it again, The whole Scratch is freezen, it seems hold for waiting some remote sensors reading?

Is it a bug of Scratch 1.4?

20091208Edit:

I know the bug is, if you displayed the remote sensor value in STAGE, after you save the project and reopen it, the Scratch will be frozen. (no matter in presentation mode or not)

I upload two sb files for open file testing.

NXT_US_test1  : I use variable (NXT_US) to display remote sensor value (NXTUS).

NXT_US_NG : I display NXTUS value directly. When you reopen it, the Scratch is frozen.

Last edited by touch_classroom (2009-12-07 23:02:34)

Offline

 

#43 2010-02-02 11:08:28

DaveK2
Scratcher
Registered: 2009-08-21
Posts: 2

Re: Remote Sensor Connections in v1.3

I am very sorry for the long delay in answering this. I haven't been watching the board, I've gotten used to emailed reply notifications, but I guess I don't have it turned on here!

itsme213 wrote:

DaveK2:
Any chance you could post a very short writeup on the scratch usage, either here or on the GoogleCode or Scratch Connections page? Just basic things like what the different elements of

  ^ pinmode 14 AnalogIn

mean, or particular things to watch out for.

I'll see what I can do. The code in uHyperCos.pas in the routine THyperCos.CommandDecode should be about all you need as far as understanding the protocol.

Also, since HyperCos commands are mostly compatible with Catenary, you can refer to the Catenary docs for commands.

As far as I know, the only difference is that HyperCos has a slightly different setup for enabling pin reporting. It supports 'reportanalog' and 'reportdigital' for turning on or off reporting for the specified pin.

Do you think it is ready for use by others?

Well, I would not expect it to be bug free, but the intention for the project is to serve as a learning platform for people interested in Delphi, Arduino and Scratch, and it's probably pretty reasonable for that. Anyone working with that combination has got to be expecting to find and learn how to fix bugs  smile   The project is pretty heavily commented, so finding any issues shouldn't be too difficult, and I'll be happy to put in fixes.

Can you please suggest which (basic) board to get, and from which source?

It's been a while since you asked; did you decide on a board? I like the Boarduino, but it isn't directly compatible with the various shields.

Lastly ... while I do have PC with XP and will first try it on that, I'd like to eventually do this on a Mac, perhaps under VMWare but preferably compiled native. Does the Delphi part do UI and other tricky cross-platform stuff, or is it likely to compile for Mac under something like FreePascal http://www.freepascal.org/ ?

I arranged the project so that all the work is done in modules with no UI. Most of these should compile under FreePascal without too much trouble.

The threading utility unit SynchedThreads.pas may need to be replaced to work on a Mac or Linux. The threaded routine (ScratchConnection.SocketReadThread() in uScratch.pas) is very simple though, so it should be an easy conversion.

The serial port is handled with TComPort, which I'm guessing might be difficult to use outside of Win32 Delphi. However, synaser, which is also in the code repository, has FPC and Linux support and it probably wouldn't be difficult to use in place of TComPort. The com port conversion would probably be the most trouble.

Whatever UI you use just needs to implement IHyperCosDisplay (for HyperCos to provide output) and optionally to publish a property of type IHyperCosControl (for debug control input). What it does with the output shouldn't effect the rest of the system. The UI that I have on it is mostly just to look pretty. It should be very easy to put a different interface on it.

Last edited by DaveK2 (2010-02-02 11:19:13)

Offline

 

#44 2010-02-18 10:50:03

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: Remote Sensor Connections in v1.3

supermario1 wrote:

Great work. Thanks for sharing, this shall come in handy.

Yeah.

OT: I like your username.

Offline

 

#45 2010-06-14 14:06:39

paulpsicle
Scratcher
Registered: 2008-10-12
Posts: 100+

Re: Remote Sensor Connections in v1.3

There is a problem on mac in 1.4..., the information only gets through when remote sensor connections are turned off.


http://blocks.scratchr.org/API.php?user=paulpsicle&amp;action=onlineStatus&amp;online=http://fishery.dyndns.org/paulpsicle.png&amp;offline=http://fishery.dyndns.org/paulpsicle_o.png

Offline

 

#46 2010-06-15 02:32:15

paulpsicle
Scratcher
Registered: 2008-10-12
Posts: 100+

Re: Remote Sensor Connections in v1.3

Maybe it's just my program (perl)


http://blocks.scratchr.org/API.php?user=paulpsicle&amp;action=onlineStatus&amp;online=http://fishery.dyndns.org/paulpsicle.png&amp;offline=http://fishery.dyndns.org/paulpsicle_o.png

Offline

 

#47 2010-08-04 08:11:01

mherma
New Scratcher
Registered: 2010-07-14
Posts: 8

Re: Remote Sensor Connections in v1.3

chalkmarrow:
you wrote, that Catenary only works with v1.3 right now, since the way variables are sent over a remote connection changed quite a bit with v1.4.
You wrote that you plan to work on a new version eventually when you get some time, Hopefully in the next month or so...

Is a version, that works with 1.4 available now?
And do you know, if the byob version from robotclub.ab.ca works correct with your catenary-tool?

thanks a lot
michael

Offline

 

#48 2010-08-09 15:31:47

chalkmarrow
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: Remote Sensor Connections in v1.3

mherma: It turns out that the old catenary works OK with v1.4 (I had forgotten how the parsing worked), at least in most applications. There was a bug with respect to the analog outputs, however, which I just fixed.

There is a newer version that includes servo capabilities, which was modified by Teresa Harmala. The scratch connections website has been pounded by spam lately, so I haven't uploaded that version yet. I'll try to attach it to the Catenary page so you can work with it.

Offline

 

#49 2010-08-13 07:56:00

mherma
New Scratcher
Registered: 2010-07-14
Posts: 8

Re: Remote Sensor Connections in v1.3

chalkmarrow: there must be another bug. Only in the old windows-cantenry-exe I can adress the pins 8 to 13.
Working with the old catenary-Version I can't address pin 8 to 13. (for example, the LEDpin8 can blink, but neither the LEDpin9 nor the LEDpin13.
(Scratch is connected, Arduino port is o.k., the white dot number 13 in the processing-window is blinking - but the led on the arduino don't blink.)

In the new version on your catenary-site both versions have this bug: you can't adress pin 8 to 13 (neither pinMode = Output nor pinMode=Input).

I tried the whole morning to understand the catenary-processing-file and the java-file. But I failed.
Can you help me please.
(p.s. the servo works fine!!)
Michael

Offline

 

#50 2010-08-13 09:22:19

mherma
New Scratcher
Registered: 2010-07-14
Posts: 8

Re: Remote Sensor Connections in v1.3

chalkmarrow: When I replace the new arduino.jar with the old one, I can adress the pins 8 to 13. But then the servo don't work. Is it possible to open and edit the jar-file?
Michael

Offline

 

Board footer