potentiometer 02_map (inByte, 0, 1023, 0, 15)

potentiometer 02 – map into 15 to make 15 different parts which maybe used to distinguish 15 different city bubbles to highlight those as users turn potentiometer. For the moment each parts draws different rectagular.

Q why the rectangular once drawn stays there forever?


This slideshow requires JavaScript.

float inByte = float(inString);
inByte = map(inByte, 0, 1023, 0, 15);
fill(255, 255, 0, 200);

if (inByte < 1) {
rect(100, 100, 50, 50);
//somehow connect to bubble[1]
}
if (inByte>1 &&  inByte < 2 ) {
rect(100, 300, 50, 50);
//somehow connect to bubble[2]
}
if (inByte>2 &&  inByte < 3 ) {
rect(100, 500, 50, 50);
}
if (inByte>3 &&  inByte < 4 ) {
rect(200, 200, 50, 50);
}
if (inByte>8 &&  inByte < 9 ) {
rect(200, 400, 50, 50);
}
if (inByte > 14  && inByte < 15   ) {
rect(300, 300, 50, 50);
//somehow connect to bubble[15]
}
println(inByte);
}

Advertisements

Comments

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s