Coding an LED Scoreboard w/ Bluetooth

Hi everyone,

I’m working on a Bluetooth Scoreboard Project based on Bob Clagett from Iliketomakestuff (Link of project: How to make a large Bluetooth scoreboard | I Like To Make Stuff - YouTube)

I’ve reached the code portion of the project and after compiling the code from his github, I realized I am using a slightly different set of LED’s than him (12mm LEDs - Arduino Code | 12mm LED Pixels | Adafruit Learning System). The slight difference is that my LED’s have a Clock In/Out Pin where Bob does not (his only have Power, Ground, and Data In/Out)

So I’m thinking I either have to A) Incorporate the clock PIN into Bob’s original code and/or B) Replace the Adafruit_NeoPixel library with the 12mm LED library (Adafruit_WS2801) into the original code

I’ve been using some of the lines of a strand_test example code from the Adafruit WS2801 website to make Bob’s original code compatible but I’ve been running into some troubleshooting issues. Or when I do get it to compile, it doesn’t seem to work properly

Any tips?


I’ll put Bob’s original code below (Some of the code is for Bluetooth):

//This code is for the project listed at

#include <CurieBLE.h>
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>

#define PIN            3
#define NUMPIXELS      60

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_RGB + NEO_KHZ800);
int delayVal = 5000;
uint32_t colorList[] = { pixels.Color(0,0,255), pixels.Color(255,255,255)  };// blue , white

BLEPeripheral blePeripheral;       // BLE Peripheral Device (the board you're programming)
BLEService arduinoService("6fbee06f-b902-4ac1-bf99-8d4a9b76db8f"); // create service

// create switch characteristic and allow remote device to read and write

BLECharCharacteristic pinD6Char("DD06", BLERead | BLEWrite );
BLECharCharacteristic pinD7Char("DD07", BLERead | BLEWrite );
BLECharCharacteristic pinD8Char("DD08", BLERead | BLEWrite );
BLECharCharacteristic pinD9Char("DD09", BLERead | BLEWrite );
BLECharCharacteristic pinD10Char("DD10", BLERead | BLEWrite );
BLECharCharacteristic pinD11Char("DD11", BLERead | BLEWrite );

BLECharCharacteristic myDchars[6] = {pinD6Char,pinD7Char,pinD8Char,pinD9Char,pinD10Char,pinD11Char};
int score[2] = {0,0};

long previousMillis = 0;  // last time the battery level was checked, in ms

int oldDValues[4] = {0,0,0,0};  // previous values for each digital pin

const int pinD6 = 6; 
const int pinD7 = 7; 
const int pinD8 = 8; 
const int pinD9 = 9; 
const int pinD10 = 10; 
const int pinD11 = 11;

int myDPins[6] = {pinD6, pinD7, pinD8, pinD9, pinD10, pinD11};

const int characterOffset = 15;
charLayout[0] = [1,1,1,

  int charLayout[10][15] = {
      {1,1,1,1,0,1,1,0,1,1,0,1,1,1,1}, //0
      {1,1,0,0,1,0,0,1,0,0,1,0,1,1,1}, //1
      {1,1,1,1,0,0,1,1,1,0,0,1,1,1,1}, //2
      {1,1,1,1,0,0,1,1,1,1,0,0,1,1,1}, //3
      {1,0,1,1,0,1,1,1,1,1,0,0,0,0,1}, //4
      {1,1,1,0,0,1,1,1,1,1,0,0,1,1,1}, //5
      {1,1,1,0,0,1,1,1,1,1,0,1,1,1,1}, //6
      {1,1,1,1,0,0,0,0,1,1,0,0,0,0,1}, //7
      {1,1,1,1,0,1,1,1,1,1,0,1,1,1,1}, //8
      {1,1,1,1,0,1,1,1,1,1,0,0,0,0,1}  //9
  } ; 

void setup() {
  Serial.begin(9600);    // initialize serial communication
  pixels.begin(); // This initializes the NeoPixel library.
  for (int i=0; i < 6; i++){
    pinMode(myDPins[i], OUTPUT);
    digitalWrite(myDPins[i], LOW);
  /* Set a local name for the BLE device
     This name will appear in advertising packets
     and can be used by remote devices to identify this BLE device
     The name can be changed but maybe be truncated based on space left in advertisement packet */
  blePeripheral.setLocalName("BLE101");  // must use this name for the BLE101 app to find it.
  blePeripheral.setAdvertisedServiceUuid(arduinoService.uuid());  // add the service UUID
  blePeripheral.addAttribute(arduinoService);   // Add the BLE Battery service

  // Configure digital ports
  for (int i=0; i < 6; i++) {

  myDchars[0].setEventHandler(BLEWritten, listener0);
  myDchars[1].setEventHandler(BLEWritten, listener1);
  myDchars[2].setEventHandler(BLEWritten, listener2);
  myDchars[3].setEventHandler(BLEWritten, listener3);
  myDchars[4].setEventHandler(BLEWritten, listener4);
  myDchars[5].setEventHandler(BLEWritten, listener5);  
  /* Now activate the BLE device.  It will start continuously transmitting BLE
     advertising packets and will be visible to remote BLE central devices
     until it receives a new connection */
  Serial.println("Bluetooth device active, waiting for connections...");

void loop() {
  // put your main code here, to run repeatedly:

BLECentral central = blePeripheral.central();

  // if a central is connected to peripheral:
  if (central) {
    Serial.print("Connected to central: ");
    // print the central's MAC address:
    // turn on the LED to indicate the connection:
    digitalWrite(13, HIGH);
    // check the battery level every 200ms
    // as long as the central is still connected:
    while (central.connected()) {
      long currentMillis = millis();
      // if 200ms have passed, check the battery level:
      if (currentMillis - previousMillis >= 200) {
        previousMillis = currentMillis;
    // when the central disconnects, turn off the LED:
    digitalWrite(13, LOW);
    Serial.print("Disconnected from central: ");

void setNumber(int side, int displayNum) {
  int sideOffset = side*characterOffset*2;
  int ones = (displayNum%10);
  int tens = ((displayNum/10)%10);
  for(int k=0;k<15;k++){
      toggleLocation(side, k+sideOffset, charLayout[tens][k]);     
      toggleLocation(side, k+characterOffset+sideOffset, charLayout[ones][k]); 
void toggleLocation(int side, int loc, int ledState){
    pixels.setPixelColor(loc, pixels.Color(0,0,0)); //off
  } else{
    pixels.setPixelColor(loc, colorList[side]); // team color

void sendDigitalValue(int pinNum) {
  if (digitalRead(myDPins[pinNum]) == LOW) {
    char lowValue = LOW;
  } else {
    char highValue = HIGH;

bool haschangedDigital(int pinNum) {
    char currentValue = digitalRead(myDPins[pinNum]);
    char previousValue = oldDValues[pinNum];

    if (currentValue != previousValue) {      
      oldDValues[pinNum] = currentValue;
      return true;
    } else {
      return false;


void listener0(BLECentral& central, BLECharacteristic& characteristic) {

void listener1(BLECentral& central, BLECharacteristic& characteristic) {

void listener2(BLECentral& central, BLECharacteristic& characteristic) {

void listener3(BLECentral& central, BLECharacteristic& characteristic) {

void listener4(BLECentral& central, BLECharacteristic& characteristic) {

void listener5(BLECentral& central, BLECharacteristic& characteristic) {

void setScore(int team, int val){
  int teamScore = score[team];
  } else {
    teamScore += val;
    if (teamScore<0){
  Serial.print("Team 1: ");
  Serial.print(" - Team 2: ");

scoreBoardBT.ino (6.58 KB)

Any tips?

Yep, put your code in code tags so it doesn’t go all italic on us and is possible to actually read.

(I’m guessing you have an array index with an i in square brackets there?)

Code tags.jpg

Just fixed it. Thanks for the tip