'This sends out a 65 to java and get back 6 bytes 'the 6 bytes go into my combos and then get shifted out to the LEDs 'actually this sends out my nice header, but java just send the stuff 'so it works anyway, sometimes I have to hit the reset button 'and it starts with the most recent numbers 'serial data variables dim outByte as byte '6-byte output buffer dim inputBuffer(1 To 17) as byte '1-byte output buffer dim outputBuffer(1 To 10) as byte dim thisByte as byte dim inByte as byte dim gotaByte as boolean 'shift register variables 'shift register pins to bx pin variables const serial as byte = 13 const strobe as byte = 14 const clock as byte = 15 const blank as byte = 16 dim time as single 'LED arrarys dim combo (1 to 8) as byte 'variable for queue position of 6 bytes received from java dim queuePos as integer dim fooVar as byte Sub Main() ' define which pins COM3 will be: call defineCom3(11,12,bx1000_1000) ' set aside memory for input and output: call openQueue(inputBuffer, 13) call openQueue(outputBuffer, 10) ' open COM3: call openCom(3, 9600, inputBuffer, outputBuffer) fooVar = 65 queuePos = 1 do 'FIND SERIAL DATA ' is there anything in line? if queuePos > 6 then call ClearMemory () call ReadyRegister () call SendSerial () call ShiftToLatch () queuePos = 1 end if gotaByte = statusQueue(inputBuffer) ' if there is data in the input buffer, get the first byte of it: if (gotaByte = true) then call getQueue(inputBuffer, inByte, 1) combo(queuePos) = inByte queuePos = queuePos + 1 else 'put something in the outputBuffer to tell java to send 'call putQueue(outPutBuffer, outByte, numBytes) 'call putQueue(outPutBuffer, 65, 1) call putQueue(outPutBuffer, fooVar, 1) queuePos = 1 end if loop End Sub Sub ClearMemory() 'Clear the memory call PutPin(blank,1) End Sub Sub ReadyRegister() 'prep register call PutPin(blank,0) call putPin(strobe,0) call PutPin(serial,0) call PutPin(clock,0) 'delay(time) debug.print "prep register" End Sub Sub SendSerial() call PutPin(blank,0) dim i as integer combo(7) = bx00000000 combo(8) = bx00000000 for i = 1 to 8 call ShiftOut(serial, clock, 8, combo(i)) next delay(time) debug.print "send serial" End Sub Sub ShiftToLatch () call PutPin(strobe,1) call PutPin(blank,0) call PutPin(strobe,0) 'delay(time) debug.print "shift to latch" End Sub