New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WeDo 2.0 tilt block #1040

Closed
cpseager opened this Issue Mar 11, 2016 · 8 comments

Comments

Projects
None yet
4 participants
@cpseager
Contributor

cpseager commented Mar 11, 2016

The new tilt sensor blocks for WeDo 2.0 are very awkward?

One of the most popular WeDo 1 exercises we use is to move scratch cat around using the tilt sensor as a joystick. This is much, much harder for youngsters to understand using the new style blocks...

Was it a deliberate decision or just simply arisen because you are trying to use the tilt sensor in the default mode 0 (TiltSensorAngle) ?

If however you use the tilt sensor in mode 1 instead (TiltSensorTilt) the results will be the same in operation as WeDo 1 (actually you get the values 0-3-5-7-9, which can be scaled to 0-3-2-4-1 to match the normal Scratch tilt directions).

This TiltSensorTilt mode is also what Lego's own software uses...

To convert the tilt sensor to mode 1 simply write this hex data to characteristic 'Input Command' after the tilt sensor connection has been notified.

 (CONFIGURE) INPUT COMMAND
 00001563-1212-efde-1523-785feabcd123

 01 02 ch 22 01 01 00 00 00 02 01   where ch = channel, 01 or 02

Incidentally the similar command for motion sensor in distance cm is

 01 02 ch 23 00 01 00 00 00 02 01
@ntlrsk

This comment has been minimized.

Show comment
Hide comment
@ntlrsk

ntlrsk Mar 17, 2016

Member

@cpseager We'll review this decision and suggestion - thanks.

Member

ntlrsk commented Mar 17, 2016

@cpseager We'll review this decision and suggestion - thanks.

@cwillisf

This comment has been minimized.

Show comment
Hide comment
@cwillisf

cwillisf Apr 4, 2016

Member

We discussed this and decided to make the changes described in #1062.
Thanks for the feedback!

Member

cwillisf commented Apr 4, 2016

We discussed this and decided to make the changes described in #1062.
Thanks for the feedback!

@cwillisf cwillisf closed this Apr 4, 2016

@arvenil

This comment has been minimized.

Show comment
Hide comment
@arvenil

arvenil Jan 9, 2017

Hi @cpseager, @ntlrsk, @cwillisf,

I'm trying to figure out where is the code responsible for this (sending commands to Wedo2 hub) in scratch repos?
Also @cpseager how did you know about command 01 02 ch 22 01 01 00 00 00 02 01? Is there anywhere description of communication protocol for Wedo2 and BLE?

Could anyone point me into a right direction?

arvenil commented Jan 9, 2017

Hi @cpseager, @ntlrsk, @cwillisf,

I'm trying to figure out where is the code responsible for this (sending commands to Wedo2 hub) in scratch repos?
Also @cpseager how did you know about command 01 02 ch 22 01 01 00 00 00 02 01? Is there anywhere description of communication protocol for Wedo2 and BLE?

Could anyone point me into a right direction?

@cwillisf

This comment has been minimized.

Show comment
Hide comment
@cwillisf

cwillisf Jan 9, 2017

Member

@arvenil, we use LEGO's SDK which is available to the public here:
https://education.lego.com/en-us/support/wedo-2/developer-kits

Member

cwillisf commented Jan 9, 2017

@arvenil, we use LEGO's SDK which is available to the public here:
https://education.lego.com/en-us/support/wedo-2/developer-kits

@cpseager

This comment has been minimized.

Show comment
Hide comment
@cpseager

cpseager Jan 9, 2017

Contributor

@arvenil as I couldn't/didn't want to use the SDK in my use case (chrome/nw.js app talking RS232 via a BLED112 dongle to support any OS from Windows XP/Mac 10.6 upwards) I simply wrote a test app using the SDK and then sniffed/directly duplicated the actual packets. I have a list somewhere if you don't want to use the SDK.

Contributor

cpseager commented Jan 9, 2017

@arvenil as I couldn't/didn't want to use the SDK in my use case (chrome/nw.js app talking RS232 via a BLED112 dongle to support any OS from Windows XP/Mac 10.6 upwards) I simply wrote a test app using the SDK and then sniffed/directly duplicated the actual packets. I have a list somewhere if you don't want to use the SDK.

@arvenil

This comment has been minimized.

Show comment
Hide comment
@arvenil

arvenil Jan 16, 2017

@cwillisf Ok, my bad. I was looking at lego sdk before, however I saw there only android/osx/windows8/ios sdk and somehow I've assumed for browser your are using javascript, not action script. So to confirm, you are using action script (windows8) sdk?

@cpseager That would be great. I was trying to follow lego SDK (mainly java/android), while this is doable it's really hard and frustrating as data packet is build by bunch of objects. Description of actual BLE protocol (e.g. what each byte does and to which characteristic send the whole packet) would be much better. I'm basically trying to hack/play/create my own sdk in language that is currently not supported by official sdk, so it's easier to also have the protocol documentation.

arvenil commented Jan 16, 2017

@cwillisf Ok, my bad. I was looking at lego sdk before, however I saw there only android/osx/windows8/ios sdk and somehow I've assumed for browser your are using javascript, not action script. So to confirm, you are using action script (windows8) sdk?

@cpseager That would be great. I was trying to follow lego SDK (mainly java/android), while this is doable it's really hard and frustrating as data packet is build by bunch of objects. Description of actual BLE protocol (e.g. what each byte does and to which characteristic send the whole packet) would be much better. I'm basically trying to hack/play/create my own sdk in language that is currently not supported by official sdk, so it's easier to also have the protocol documentation.

@cwillisf

This comment has been minimized.

Show comment
Hide comment
@cwillisf

cwillisf Jan 17, 2017

Member

@arvenil we're using the Windows & OS X versions of the LEGO Device SDK through the Scratch Device Manager. Scratch uses a WebSocket connection to communicate with the Device Manager.

See here for user-oriented info about the Device Manager: https://scratch.mit.edu/wedo

The Device Manager is built using mostly JavaScript and I've intentionally avoided steps which would make it difficult to read the code. Feel free to dig through its code if that would be helpful :)

Member

cwillisf commented Jan 17, 2017

@arvenil we're using the Windows & OS X versions of the LEGO Device SDK through the Scratch Device Manager. Scratch uses a WebSocket connection to communicate with the Device Manager.

See here for user-oriented info about the Device Manager: https://scratch.mit.edu/wedo

The Device Manager is built using mostly JavaScript and I've intentionally avoided steps which would make it difficult to read the code. Feel free to dig through its code if that would be helpful :)

@cpseager

This comment has been minimized.

Show comment
Hide comment
@cpseager

cpseager Jan 17, 2017

Contributor

@arvenil, see repo on my github page. It should give you enough info to switch on motors, change color etc.

Contributor

cpseager commented Jan 17, 2017

@arvenil, see repo on my github page. It should give you enough info to switch on motors, change color etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment