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

#1 2010-03-30 15:43:17

VIVCOOL
Scratcher
Registered: 2009-12-09
Posts: 48

PicoBoard

How do you make the slider values 0-100 correspond to screen position of -250 to 250 on Scratch?


http://forums.miniclip.com/image.php?u=122582&type=sigpic&dateline=1279443869http://comeandhavefun.freeforums.org/index.php| http://technolife.freeforums.org/index.php | http://yourgfx.freeforums.org/index.php

Offline

 

#2 2010-03-31 16:55:03

ajbarrosbr
Scratcher
Registered: 2008-01-24
Posts: 13

Re: PicoBoard

Hi,

Well, x screen positions vary from -240 to 240.
Based on Map function from Arduino programming language, you can do something like this:

( (sliderSensorValue - 0) * (240 - (- 240)) / (100 - 0) ) + (- 240)

or

(sliderSensorValue * 480 / 100) - 240.

I uploaded a little scratch project to show this at http://scratch.mit.edu/projects/ajbarrosbr/960590.

Hope this help.

ajbn

Last edited by ajbarrosbr (2010-03-31 16:59:45)

Offline

 

#3 2010-05-02 15:54:24

BigDolphin
Scratcher
Registered: 2009-12-21
Posts: 81

Re: PicoBoard

Sorry, I dont know because i dont have one, but i want to know...
Are they worth it?
<stop all>


►►►►►►►►►♠"Thy fish no like thy Trout that deceives thy eye"♠◄◄◄◄◄◄◄◄◄

Offline

 

Board footer