If x has been updated.

Hmmm, I'm pretty sure I already posted this, but...

How would I write my code to see if a value has been updated?

Here's my setup:

PHP Webpage with a form with either a ON or an OFF option(1 or 0 sent)

Visual Basic backend that simply grabs said bits and forwards them.

Arduino sketch that sees if the Serial port has been updated, then updates values.

64-bit shift register that controls a NightRider style bar(came stock, might pull it apart later)

I'm trying to find some code that'll check if a new bit has been written and update it on the bar.

The problem I see is that if the current bit is a 0,and the new one is also a 0, it wouldn;t be feasible to detect a "change" in the variable.

Past this point is all my current code(It's written to run a RGB LED, but I want to modify it to allow KBar data sending without specifying RGB Bits.

BACKEND Half of PHP

<?php
if(isset($_REQUEST['r']) && is_numeric($_REQUEST['r']) && isset($_REQUEST['g']) && is_numeric($_REQUEST['g']) && isset($_REQUEST['b']) && is_numeric($_REQUEST['b']))
{
      $fp = @fsockopen('127.0.0.1', 1000, $errno, $errstr, 3);
      if($fp)
      {
            fputs($fp, chr($_REQUEST['r']).chr($_REQUEST['g']).chr($_REQUEST['b']));
      }
      else
      {
            die('<b>Error('.$errno.'):</b>'.$errstr);
      }
}
header('Location: ../LEDToy');
?>

Da Bumb (Black Eyed Peas)

It's not entirely clear what you're trying to do here. I think that your sketch is monitoring a serial port and if data is received then act on it. In that case can't you simply use the serial library, and it will tell you if bytes are available (so have your VB code send each bit in an entire byte package).

If you really need to have a stream of bits where you act on every bit, you won't be able to use the UART or serial library (they exist to hide the individual bit-level work).

You can set up your own bit protocol. As far as dealing with the problem of two 0's in a row, there are several techniques. You can start by looking up "Manchester coding".