Multiple use of Lookup

sniper887

Member
Working on the code for my TLC59108 RGB LED project, I wanted to reference the same lookup table, but in different spots for different LED boards. The idea is having the colors run from one LED board to another. I've tried to have one part of the code gosub to the subroutine with the lookup tables, then gosub to the hi2cout command to send the values to the TLC59108, then add a certain amount to the variable, gosub to the same lookup subroutine, then to a different hi2cout command after an hi2csetup command to change the I2C address (the 08M2 doens't support new i2c address in brackets), then subtract the same amount as before from the same variable before the NEXT command in the FOR. . .NEXT loop. It seems like the extra math with the variable is causing the lookup to skip values. The following code just slowly fades through the same colors on all LED boards, because the i2c address used is the all call address.
Code:
setfreq k500

hi2csetup i2cmaster, %10010000, i2cfast, i2cbyte
hi2cout (%00000000,%00001111)
hi2cout (%00000001,%00000000)
hi2cout ($0C, %10101010) 
hi2cout ($0D, %10101010)
symbol blue = b0
symbol green = b1
symbol red = b2
symbol pauselength = w5

pauselength = 0
start:
b8 = 0
b4 = 0
b5 = 0
b6 = 0
for b4 = 0 to 255

gosub lowlookup
gosub colorout

next b4

for b4 = 0 to 255

gosub highlookup
gosub colorout

next b4

goto start

colorout:

hi2cout $A2, (blue, red, green, 0, blue, red, green)

return


lowlookup:
lookup b4,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,5,8,11,14,17,20,23,26,29,32,35,38,41,44,47,50,53,56,59,62,65,68,71,74,77,80,83,86,89,92,95,98,101,104,107,110,113,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,176,179,182,185,188,191,194,197,200,203,206,209,212,215,218,221,224,227,230,233,236,239,242,245,248,251),red
lookup b4,(255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,252,249,246,243,240,237,234,231,228,225,222,219,216,213,210,207,204,201,198,195,192,189,186,183,180,177,174,171,168,165,162,159,156,153,150,147,144,141,138,135,132,129,126,123,120,117,114,111,108,105,102,99,96,93,90,87,84,81,78,75,72,69,66,63,60,57,54,51,48,45,42,39,36,33,30,27,24,21,18,15,12,9,6,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),green
lookup b4,(0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204,207,210,213,216,219,222,225,228,231,234,237,240,243,246,249,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255),blue
;debug

return

highlookup:
lookup b4,(255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,252,249,246,243,240,237,234,231,228,225,222,219,216,213,210,207,204,201,198,195,192,189,186,183,180,177,174,171,168,165,162,159,156,153,150,147,144,141,138,135,132,129,126,123,120,117,114,111,108,105,102,99,96,93,90,87,84,81,78,75,72,69,66,63,60,57,54,51,48,45,42,39,36,33,30,27,24,21,18,15,12,9,6,3),red
lookup b4,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204,207,210,213,216,219,222,225,228,231,234,237,240,243,246,249,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255),green
lookup b4,(254,251,248,245,242,239,236,233,230,227,224,221,218,215,212,209,206,203,200,197,194,191,188,185,182,179,176,173,170,167,164,161,158,155,152,149,146,143,140,137,134,131,128,125,122,119,116,113,110,107,104,101,98,95,92,89,86,83,80,77,74,71,68,65,62,59,56,53,50,47,44,41,38,35,32,29,26,23,20,17,14,11,8,5,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),blue


return
 

hippy

Technical Support
Staff member
It seems you are trying to change the FOR-NEXT control variable within the FOR-NEXT, for example -

Code:
For b4 = 0 To 255
  Gosub ReadData
  Gosub SendData
  b4 = b4 + 100
  Gosub ReadData
  Gosub SendData
  b4 = b4 - 100
Next
That should work so perhaps it's a problem with how you coded it when trying it ?

My bet is on twice adding a value to the index variable, rather than an add then subtraction to restore it to what it was, or one of the GOSUB also altering the index variable.

It is best to post the actual code which doesn't work so people can advise what's wrong with it as well as the working code from the earlier version.
 

inglewoodpete

Senior Member
I'm not sure if others are having the same trouble as me. However, I'm sure there are forum members out there that could help but your problem is not clear to me. Dealing with a complex problem requires you to "make it easy" for some else coming in cold. I think a circuit diagram of your circuit will help.

You mention several LED boards. How are they interconnected? Can you provide a link to a TLC59108 datasheet too?
 

Buzby

Senior Member
I'm not sure is I've missed something in this thread, has there been an edit or deletion ?

Anyway, hippy's code example shows 'b4 = b4 + 100'.
As I'm sure hippy knows, but didn't mention, b4 is only a byte, so the value can't be over 255, it rolls over.

This will do tricky things with the for next, as b4 = b4 + 100 followed by b4 = b4 - 100 will might not give the same result if there has been an overflow inbetween

This might be what is intended, but it might not.

Cheers,

Buzby
 

hippy

Technical Support
Staff member
b4 = b4 + 100 followed by b4 = b4 - 100 will might not give the same result if there has been an overflow inbetween
As long as anything done to the FOR-NEXT control variable within the FOR-NEXT is undone before the NEXT the FOR-NEXT will behave and sequence as expected.

b4=b4+N then b4=b4-N will always return b4 to what it was initially regardless of overflow or underflow.

If something is done but not undone that will affect the FOR-NEXT sequencing, affect lookups and other things which use the variable, and that's what I expect the coding bug is in the OP's case.
 

Buzby

Senior Member
Hi hippy,

Sorry, I read it too quick.
Of course add and subtract are reversible, even across under/overflow.
I'm not sure what I was thinking !

Cheers,

Buzby
 

sniper887

Member
After some thinking with a fresh mind, and debugging I figured it out. For the part of the code where the offset is different, it works exactly like it should. The problem is I use 2 sets of lookups, and the normal part of the code goes through one, then the other. The offset part starts in the middle of the first lookups, rolls over at the end to the beginning of the first, then goes to the middle, then goes to the second lookups where it also starts in the middle, rolls over at the end and ends at the middle. The issue is when it rolls over at the end, it goes to the start of the first lookups, causing a jump in colors. I wanted it at the roll over to go to the middle of the second lookups which it doesn't do. Might have to get clever with the code for that, or shorten the color map to use just one set of lookups. My code uses up almost the entire program space on the 08M2. I might play with I2C EEPROM or FRAM, or simply Picaxe chips with more program space, to store larger color maps.

Code:
 setfreq m16

hi2csetup i2cmaster, %10010000, i2cfast_16, i2cbyte
hi2cout (%00000000,%00001111)
hi2cout (%00000001,%00000000)
hi2cout ($0C, %10101010) 
hi2cout ($0D, %10101010)
symbol blue = b0
symbol green = b1
symbol red = b2
symbol pauselength = w5
symbol addrs = b10
pauselength = 0
start:
b8 = 0
b4 = 0
b5 = 0
b6 = 0
for b4 = 0 to 255
addrs = %10000110
gosub lowlookup
gosub colorout
b4 = b4 + 128
addrs = %10000000
gosub lowlookup
gosub colorout
b4 = b4 - 128



next b4

for b4 = 0 to 255
addrs = %10000110
gosub highlookup
gosub colorout
b4 = b4 + 128
b5 = b4 + 128

addrs = %10000000
gosub highlookup
gosub colorout
b5 = b4 - 128
b4 = b4 - 128

debug
next b4

goto start

colorout:
hi2csetup i2cmaster, addrs, i2cfast_16, i2cbyte
hi2cout $A2, (blue, red, green, 0, blue, red, green)

return


lowlookup:
lookup b4,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,5,8,11,14,17,20,23,26,29,32,35,38,41,44,47,50,53,56,59,62,65,68,71,74,77,80,83,86,89,92,95,98,101,104,107,110,113,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,176,179,182,185,188,191,194,197,200,203,206,209,212,215,218,221,224,227,230,233,236,239,242,245,248,251,255),red
lookup b4,(255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,252,249,246,243,240,237,234,231,228,225,222,219,216,213,210,207,204,201,198,195,192,189,186,183,180,177,174,171,168,165,162,159,156,153,150,147,144,141,138,135,132,129,126,123,120,117,114,111,108,105,102,99,96,93,90,87,84,81,78,75,72,69,66,63,60,57,54,51,48,45,42,39,36,33,30,27,24,21,18,15,12,9,6,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),green
lookup b4,(0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204,207,210,213,216,219,222,225,228,231,234,237,240,243,246,249,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255),blue
return

highlookup:
lookup b4,(255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,252,249,246,243,240,237,234,231,228,225,222,219,216,213,210,207,204,201,198,195,192,189,186,183,180,177,174,171,168,165,162,159,156,153,150,147,144,141,138,135,132,129,126,123,120,117,114,111,108,105,102,99,96,93,90,87,84,81,78,75,72,69,66,63,60,57,54,51,48,45,42,39,36,33,30,27,24,21,18,15,12,9,6,3,0),red
lookup b4,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204,207,210,213,216,219,222,225,228,231,234,237,240,243,246,249,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255),green
lookup b4,(254,251,248,245,242,239,236,233,230,227,224,221,218,215,212,209,206,203,200,197,194,191,188,185,182,179,176,173,170,167,164,161,158,155,152,149,146,143,140,137,134,131,128,125,122,119,116,113,110,107,104,101,98,95,92,89,86,83,80,77,74,71,68,65,62,59,56,53,50,47,44,41,38,35,32,29,26,23,20,17,14,11,8,5,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),blue



return
 

inglewoodpete

Senior Member
My suggestion would be to use separate pointer variables: leave b4 alone! Then you can fiddle with its value to your heart's content.

Code:
for b4 = 0 to 255
   addrs = %10000110
   b5 = b4: b6 = b4
   gosub highlookup   'use b5 and/or b6 in this subroutine
   gosub colorout
   b5 = b5 + 128
   b6 = b6 + 128

   addrs = %10000000
   gosub highlookup   'use b5 and/or b6 in this subroutine
   gosub colorout
   'no need to restore the reg's values here.

   debug
next b4
It really helps to make your code more readable if you use indentation for your loops etc.
 

sniper887

Member
This is what I came up with that works:

Code:
setfreq m2

hi2csetup i2cmaster, %10010000, i2cfast, i2cbyte
hi2cout (%00000000,%00001111)
hi2cout (%00000001,%00000000)
hi2cout ($0C, %10101010) 
hi2cout ($0D, %10101010)
symbol blue = b0
symbol green = b1
symbol red = b2
symbol pauselength = w5
symbol addrs = b10
pauselength = 0
start:
	b8 = 0
	b4 = 0
	b5 = 0
	b6 = 0
	
	for b4 = 0 to 255
		addrs = 134
		gosub lowlookup
		gosub colorout
		b4 = b4 + 64
		addrs = 128
		gosub lowlookup
		gosub colorout
		b4 = b4 - 64
		b4 = b4 + 128
		addrs = 130
		gosub lowlookup
		gosub colorout
		b4 = b4 - 128
		b4 = b4 + 192
		addrs = 136
		gosub lowlookup
		gosub colorout
		b4 = b4 - 192
	next b4
goto start
	
	colorout:
	hi2csetup i2cmaster, addrs, i2cfast_16, i2cbyte
	hi2cout $A2, (blue, red, green, 0, blue, red, green)
	return
	
	lowlookup:
	lookup b4,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,8,14,20,26,32,38,44,50,56,62,68,74,80,86,92,98,104,110,116,122,128,134,140,146,152,158,164,170,176,182,188,194,200,206,212,218,224,230,236,242,248,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,252,246,240,234,228,222,216,210,204,198,192,186,180,174,168,162,156,150,144,138,132,126,120,114,108,102,96,90,84,78,72,66,60,54,48,42,36,30,24,18,12,6),red
	lookup b4,(255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,249,243,237,231,225,219,213,207,201,195,189,183,177,171,165,159,153,147,141,135,129,123,117,111,105,99,93,87,81,75,69,63,57,51,45,39,33,27,21,15,9,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,12,18,24,30,36,42,48,54,60,66,72,78,84,90,96,102,108,114,120,126,132,138,144,150,156,162,168,174,180,186,192,198,204,210,216,222,228,234,240,246,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255),green
	lookup b4,(0,3,9,15,21,27,33,39,45,51,57,63,69,75,81,87,93,99,105,111,117,123,129,135,141,147,153,159,165,171,177,183,189,195,201,207,213,219,225,231,237,243,249,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,251,245,239,233,227,221,215,209,203,197,191,185,179,173,167,161,155,149,143,137,131,125,119,113,107,101,95,89,83,77,71,65,59,53,47,41,35,29,23,17,11,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),blue
	return
The indentation does make the code much more readable. I'll have to remember that, especially when posting it on here.
 
Top