Monday, August 31, 2009
Friday, August 28, 2009
Wednesday, August 26, 2009
Tuesday, August 25, 2009
Errands being run until they're tired.
10341 Venice Boulevard
Los Angeles, CA 90034
Tel: 310.841.0289
(I've heard that Major Surplus & Survival and the Supply Sargent are both also very good) and The Salvation Army Thrift Store
1658 11th St
Santa Monica, CA 90404
(Out of the Closet is another great organization but this one is huge.)
Monday, August 24, 2009
Saturday, August 22, 2009
Generating Permutations and Combinations
void loop() { delay(2000); // time to switch over to serial mode if (i < 1) { // do it only once for (b=0; b<64; b ++) { commandByte = b + B10000000; // add the latch command Serial.print("colorArray["); Serial.print(b, DEC); Serial.print("] = B"); Serial.print(commandByte, BIN); Serial.println(";"); } } i++; }
Just a heads up, this works because I added the 1 onto the left edge of the command byte by adding the actual value of B10000000 to the variable NOT by trying to tack a "B10" on to it on with Serial.print before. Why not? 63 prints out as 111111, 6 characters, but 23 is 10111, 5 characters. You can't just paste numbers to left edge with text and expect the value to be correct when you copy the printout. Writing your own program is way more time consuming for a non-numeric situation like writing out UP OFF DOWN and ON for the Synoptic Lab style code - In case you don't remember those lines look like: docolor(DOWN, DOWN, UP,128/(2*SPULSE),1); You'd start with something like the below, but I haven't tested it. void permutate(int n_options, int r_times) { int n; int r; for (r=0; r<r_times; r ++) { for (n=0; n<n_options; n ++) { Serial.print(r, DEC); Serial.print(" : "); Serial.print(n, DEC); Serial.print(" | "); } Serial.println(); } Serial.println(); }
I just borrowed Math is Fun's permutations and combinations calculator (below). They generated the list and with a bit of find and replace magic in BBEdit I got the code I needed. Oh, and for those of you who are curious and don't care about having a pre-written array the following function does work, and is what the attached video is of. void playAll() { int b; for (b=0; b<64; b ++) { nextColor = colorArray[b]; nextCommand = nextColor + B10000000; // latch it doColor2(nextCommand); } }
<div class="posterous_bookmarklet_entry"><div class="posterous_quote_citation">via <a href="http://www.mathsisfun.com/combinatorics/combinations-permutations-calculator.html">mathsisfun.com</a></div>
<p> </p>
</div>
Generating Permutations and Combinations
void loop() { delay(2000); // time to switch over to serial mode if (i < 1) { // do it only once for (b=0; b<64; b ++) { commandByte = b + B10000000; // add the latch command Serial.print("colorArray["); Serial.print(b, DEC); Serial.print("] = B"); Serial.print(commandByte, BIN); Serial.println(";"); } } i++; }
Just a heads up, this works because you add the 1 onto the left edge of the command byte by adding the actual value of the variable not by trying to tack it on with Serial.print before it. What I mean is that 63 prints out as 111111, 6 characters, but 23 is 10111, 5 characters. You can't just paste numbers to left edge with text and expect the value to be correct when you copy the printout. This writing your own program is way more time consuming for a non-numeric situation like writing out UP OFF DOWN and ON for the Synoptic Lab style code - In case you don't remember those lines look like: docolor(DOWN, DOWN, UP,128/(2*SPULSE),1); You'd start with something like the below, but I haven't tested it. void permutate(int n_options, int r_times) { int n; int r; for (r=0; r<r_times; r ++) { for (n=0; n><n_options; n ++) { Serial.print(r, DEC); Serial.print(" : "); Serial.print(n, DEC); Serial.print(" | "); } Serial.println(); } Serial.println(); }
I just borrowed Math is Fun >'s permutations and combinations calculator. They generate the list and then a bit of find and replace magic in BBEdit got me the code I needed. Oh, and for those of you who are curious and don't care about having a pre-written array the following function does work, and is what the attached video is of. void playAll() { int b; for (b=0; b<64; b ++) { nextColor = colorArray[b]; nextCommand = nextColor + B10000000; // latch it doColor2(nextCommand); } }
Friday, August 21, 2009
Last significant HL1606 update before the burn...
// ----- some stuff from the setup colorArray[0] = B10000000; // Dark colorArray[1] = B10100001; // Pink Red colorArray[2] = B10000001; // Red Red colorArray[3] = B10000101; // Yellow colorArray[4] = B10000100; // Green colorArray[5] = B10010000; // Blue colorArray[6] = B10010100; // Turquoise colorArray[7] = B10010001; // Purple colorArray[8] = B10010101; // White //gradient gradientArray[0] = 0; // what gradient does if sensor is out of bounds too low // set this to the same as the one after it if you don't care gradientArray[1] = 8; gradientArray[2] = 6; gradientArray[3] = 5; gradientArray[4] = 2; //what gradient does if sensor is out of bounds too high //set this to the same color as the one before it if you //don't care. // ---- end in setup //---- partial main loop gradientLineLevel = analogRead(sensorPin); // get a reading from the fsr gradientNum = getGradientLevel(gradientLineLevel); // get what gradient segment you are //in the future could run case statements that have light patterns doColor(gradientArray[gradientNum], 20); // low duration, more responsive system. //my version of doColor looks a lot like the doNote function is some previous code //but without the "white space" at the end of it. //---- end of some of the stuff in mail loop byte getGradientLevel(int myLineLevel) { int s; if (myLineLevel > gradientMax) { return (gradientArrayLength-1); } if (myLineLevel < gradientMin) { return 0; } for (s = 1; s <= (gradientArrayLength-2); s++) { int myMin = gradientMin + (s-1)*gradientSteps; int myMax = gradientMin + (s)*gradientSteps; // covers the extra little slop so I don't have to deal with // making gradientSteps a float if (s == (gradientArrayLength)) { myMax = gradientMax; } // range hit if (myLineLevel >= myMin && myLineLevel <= myMax) { return s; } } // if it made it through the for loop with no hits, out of bounds exception // should really never get here b/c of if statements at top of function return 0; } void setGradientRange() { gradientMax = analogRead(sensorPin); gradientRange = gradientMax - gradientMin; // gradient steps uses gradientArrayLength-1 as the divisor //because gA[0] is the out of bounds exception //gA[last] is the upper out of bounds exception gradientSteps = gradientRange/(gradientArrayLength-2); }
Thursday, August 20, 2009
HL1606: Separated timing and rate, rate based on potentiometer
void twoBits() { int l; for (l=0; l< 8; l++) { //add a check kill switch doNote(twoBitNoteArray[l], twoBitTimeArray[l], millis()); } // just a little extra white space at the end in case it isn't followed // by a clearStrip(); doNote(0,300, millis()); } void doNote (byte colorNum, int duration, long startTime) { int d; int r; int mCheck = 0; byte color = colorArray[colorNum]; long endTime = startTime + (long) duration; // release whitespace eats into the previous note!!!!!!!! while (millis() < (endTime-release)) { //add a check_kill_switch mCheck = micros() % rateModulo; if (mCheck==0) { //Serial.println(mCheck); mystrip.pushCmd(color); mystrip.latch(); } } while (millis() < endTime) { //add a check_kill_switch mCheck = micros() % rateModulo; if (mCheck==0) { mystrip.pushCmd(colorArray[0]); mystrip.latch(); } } }
Wednesday, August 19, 2009
Shave and a hair cut... Color and Time on HL1606 (tags: electronics, physcomp, HL1606, Arduino)
Tuesday, August 18, 2009
HL1606 Digital Manual Control
if (pressFlag) { nextColor = colorArray[i]; mystrip.pushCmd(nextColor); mystrip.latch(); i++; } if (i >= 9) { i = 0; }
Which basically means every time the button gets pushed get the next item in the 10 item array and send it as a command byte to the LED strip. Because the latch is only thrown when the button is pressed it requires a button press for the colored lights to march on up the strip. I wrote this code to make sure I knew how the the bytes were flowing out and what they were doing to the LEDs because I was having some trouble with the original "doColor" function. The byte array I wrote looks like this: colorArray[0] = B10000001; colorArray[1] = B10000101; colorArray[2] = B10000100; colorArray[3] = B10010100; colorArray[4] = B10010000; colorArray[5] = B10010101; colorArray[6] = B10010001; colorArray[7] = B10000000; colorArray[8] = B10001010; colorArray[9] = B10100010;
It looks a lot some colors we saw in John Cohn's Pixaxe code... The important thing to remember when looking at these numbers is that the bit furthest to the right is the one that gets send first, so when it is 1 the red LED is on. The command byte is explained in the Synoptic Labs library, but keep in mind it is explained as LEFT -> RIGHT, so the INVERSE of what you might think you're seeing here. I've added a couple of graphics to show the current set up and how it works. I'll make another video when the results are more exciting. I'm attaching the code as a compressed file so it won't get displayed in its entirety.
See and download the full gallery on posterous
Arduino Board Switch
* Open the new (Arduio 16)
* Switch the type of board I was using (there are A LOT of new ones)
* and then QUIT ARDUINO 16 AND REOPEN IT. I do this because then
Arduino writes a preferences file when it quits. I've found that
having the new version writes its own is just a nice just-in-case
that smooths over some troubles occasionally. And the good news... When I attached the wires to the new board and uploaded the code it just worked! Yay!
101 Product Design - Ideas - Dwell
101 Product Design
We’re surrounded by legions of products, most of them unremittingly lousy. What separates the good from the bad from the ugly? Take out your well-designed pencils for Product Design 101.
Nice neat little article on Product Design in Dwell this month.
Pros: Including "TIMTOWTDI" in the words to know (there is more than one way to do it)
Cons: NOT including Cradle to Cradle in the "Books you should read." I know, I know, they only picked 3... Although hopefully the Taschen book, Designing the 21st Century, might have some of that in it. I'll have to check it out!
Succulent Pie
Machine Project and the Succulent Quilt
Succulent Quilt at Machine Project
Friday, August 7, 2009
New Chicks...
Thursday, August 6, 2009
Winner Coolest Factoid of the Week: Raspberry filling at the center of the Milky Way
Found: The Galaxy’s Flavor
Astronomers detected the chemical responsible for raspberries’ flavor—and one of the largest molecules ever found in space—in a dust cloud at the center of the Milky Way.
Wednesday, August 5, 2009
The Chipped Tea Cup Changes
Fry's: Fountain Valley vs. Manhattan Beach
10800 Kalama River Avenue
(714) 378-4400
FAX (714) 378-4418 Manhattan Beach, CA
3600 Sepulveda Boulevard
(310) 364-3797
FAX (310) 364-3718