Controlling an 8x8 LED Matrix via USB / Web Page

I am trying to control an 8x8 Led Matrix on an arduino connected to the USB port via a web page.

I currently have a web page set up where clicks on a table cell change that bit to a 1 or a 0 and write to a text file on my web server.

sample contents of the text file would be

B00111100,B01111110,B11111111,B11011011,B01111110,B00111100,B00000000,B00111100,

I am running a processing script that reads the text file and loads it into the serial port

Processing Code:

import java.util.Arrays;
import processing.serial.*;
Serial ComPort;
String input[], prev[];
String current;
String last = "0";

void setup() {
  String portName = Serial.list()[1];
  ComPort = new Serial(this, portName, 9600);
  println(ComPort);
  ComPort.bufferUntil('\n');
}

void draw() {
  input = loadStrings(" path to ascii-art.txt");
  current = input[0];

  if (Arrays.equals(input, prev)) {
  } else {
    ComPort.write(current);
    last = current;
    print(current + "\n\n");
    prev = input.clone();
  }
  input = null;

  delay(50);
}

I can see in the processing console log that this is working.

I load the following code onto the arduino:

Arduino Code

const int columnPins[] = { 6, 7, 8, 9, 10, 11, 12, 13};
const int rowPins[] = { 2, 3, 4, 5, 17, 16, 15, 14};
byte displayArt[] = {B00111100, B01111110, B11111111, B11011011, B01111110, B00111100, B00000000, B00111100,};

void setup() {
  Serial.begin(9600);
  for (int i = 0; i < 8; i++)
  {
    pinMode(rowPins[i], OUTPUT); // make all the LED pins outputs
    pinMode(columnPins[i], OUTPUT);
    digitalWrite(columnPins[i], HIGH); // disconnect column pins from Ground
  }
}

void loop() {
  //key = "";
  if (Serial.available()) {
    while (Serial.available()) {
      //key = Serial.readString();
      for (int i = 0; i < 8; i++) {
        displayArt[i] = Serial.parseInt();
      }
    }
  }

  show(displayArt);
}

void show( byte * image)
{
  for (int row = 0; row < 8; row++)
  {
    digitalWrite(rowPins[row], HIGH); // connect row to +5 volts
    for (int column = 0; column < 8; column++)
    {
      boolean pixel = bitRead(image[row], column);
      if (pixel == 1)
      {
        digitalWrite(columnPins[column], LOW); // connect column to Gnd
      }
      delayMicroseconds(300); // a small delay for each LED
      digitalWrite(columnPins[column], HIGH); // disconnect column from Gnd
    }
    digitalWrite(rowPins[row], LOW); // disconnect LEDs
  }
}

With the arduino plugged into the usb port, it will display the preloaded displayArt, but when I start up the processing script it does not display correctly. Any ideas about how to approach problem solving this would be appreciated.

I have also tried removing the Bs from the text file, but still do not get the intended results.

Hi

Have a look at this, similar objective, serial data comes via BT.

Serial.parseInt() expects decimal (and doesn’t understand binary even if prefixed with “B”). It will interpret “01000000” as one million, decimal. So either write your text file in decimal or get your processing script to convert from binary to decimal.