Newbs first project - No Blinken, No Bonken

I am trying to follow an instructable for a arduino powered game, Das Blinken Bonken. While this is my first go, I felt arrogant enough to convert it to a hockey target adding an extra target to the mix (my whole goal is to give my son and his friends something fun to shoot at). I have wired it all up (first time soldering), adapted the code posted from git hub. and ... nothing, absolutely nothing.
I am using the online ide to validate and load the code with no errors, but I am not getting the startup sequence on the 7 segment display.
The leds on the arduino is working.
Using a volt meter I can see that the 7 segment display is getting the 5 volts (As are the rest of the leds) but I don't know how to troubleshoot this.

how do I use the ide to ... test things? or validate what is running, what it does or doesn't see.

I am pasting the initializing code below in case that is helpful. with all the games it is too big.

I Am looking for advice on troubleshooting. Thanks to any takers :slight_smile:

#include <Wire.h> 
#include <Adafruit_NeoPixel.h>

#define PIN 6

const int max_pixels = 25;

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(max_pixels, PIN, NEO_GRB + NEO_KHZ800);

#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"

Adafruit_7segment matrix = Adafruit_7segment();

void (*fade_func)();

typedef struct {
  void (*loop_fun)();
  void (*init_fun)();
  void (*menu_fun)();
} Game;


#define MENU_GAME 0
#define AIM_GAME 1
#define MINE_GAME 2
#define SPEED_GAME 3
#define FILLIT_GAME 4
#define REDVBLUE_GAME 5
#define ALG_GAME 6
#define CALIBRATE 7

//function prototypes used to be generated correctly, now we have to do them manually...
void menu();
void menu_init();
void aim();void aim_init();void aim_menu();
void mine();void mine_menu();
void spd();void spd_init();void spd_menu();
void fillit();void fillit_init();void fillit_menu();
void redvblue();void redvblue_init();void redvblue_menu();
void calibrate();void calibrate_init();void calibrate_menu();

const int game_count = CALIBRATE+1;
Game games[game_count] = {
  {menu,menu_init,0},
  {aim,aim_init,aim_menu},
  {mine,aim_init,mine_menu},
  {spd,spd_init,spd_menu},
  {fillit,fillit_init,fillit_menu},
  {redvblue,redvblue_init,redvblue_menu},
  {calibrate,calibrate_init,calibrate_menu}};
int current_game = AIM_GAME;

const uint16_t num_pads = 5;
uint16_t pads[5];
int pad_hit;
int fader;
uint32_t fade_to;

#define PAD_M 0
#define PAD_B 1
#define PAD_L 2
#define PAD_R 3
#define PAD_BL 4
#define PAD_M_PIX 23
#define PAD_B_PIX 22
#define PAD_L_PIX 20
#define PAD_R_PIX 21
#define PAD_BL_PIX 24
#define HIT_THRESHOLD 75
#define pad_pixel(p) (24-p)
#define COUNT_DOWN_TIME 400
#define SCORE_BLINKS 4
#define ROUNDS 4
#define LEVEL_BAR_PIXELS 20

int *points;
int points_1 = 0;
int points_2 = 0;
long color_1,color_2;
long *color;
long time = 0;
long turn;
int rounds;

void setup() {
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
  matrix.begin(0x70);
  pad_hit = -1;
  set_game(MENU_GAME);
}

void loop() {
  (*games[current_game].loop_fun)();
}

//------- UTILS -------------
void clear_all() {
  matrix.clear();
  for(int i=0;i<max_pixels;i++) {
    strip.setPixelColor(i, 0);
  }
  matrix.writeDisplay();
  strip.show();
}

int pad_check() {
  read_pads();
  if (pad_hit >= 0) {
    set_pixel_brightness(pad_pixel(pad_hit),fader,*color);
    fader--;
    if (fader == 0) {
       strip.setPixelColor(pad_pixel(pad_hit), fade_to);
       strip.show();
       pad_hit = -1;
       if (fade_func != 0) {
         (*fade_func)();
         fade_func = 0;
       }
    }
  }
  else {
    if (pads[PAD_L]> HIT_THRESHOLD && pads[PAD_R] > HIT_THRESHOLD) {
      set_game(MENU_GAME);
      return 0;
    }
    for(uint16_t i=0;i<num_pads;i++) {
      if (pads[i] > HIT_THRESHOLD ) {
        pad_hit = i;fader = 255;
        return 1;
      }
    }
  }
  return 0;
}


int game_choice;

void set_game(int game) {
  if (game == MENU_GAME && current_game != MENU_GAME) game_choice = current_game;
  current_game = game;
  (*games[current_game].init_fun)();
}

void draw_score() {
  matrix.print(*points);
  matrix.writeDisplay();

}


//----------------------------------------------------------------------
// MENU
void name() {
  matrix.clear();
  if (games[game_choice].menu_fun == 0) {
    matrix.print(game_choice);
  }
  else {
    (*games[game_choice].menu_fun)();
  }
    matrix.writeDisplay();
 }

void menu() {
  if (pad_check()) {
    if (pad_hit == PAD_L || pad_hit == PAD_R) {
      game_choice+= (pad_hit == PAD_L) ? -1 : 1;
      if (game_choice >= game_count) {
        game_choice = 1;
      }
      else if (game_choice <= 0) {
        game_choice = game_count -1;
      }
      name();
    }
    else {
      set_game(game_choice);
    }
  }
}
void menu_init() {
  clear_all();
  color_1 = strip.Color(255,255,255);
  fade_to = strip.Color(255,128,0);
  color = &color_1;
  strip.setPixelColor(PAD_L_PIX, 255,128,0);
  strip.setPixelColor(PAD_R_PIX, 255,128,0);
  strip.show();
  name();
}

//----------------------------------------------------------------------
// RED VERSUS BLUE  removed code due to post limit


//----------------------------------------------------------------------
// CALIBRATE
int m = 10;
int d= 1;
uint16_t counter = 0;
int current_pad;
void calibrate_init() {
  counter = 0;
}

void calibrate() {
  read_pads();
  for(uint16_t i=0;i<num_pads;i++) {
      if (pads[i] > HIT_THRESHOLD ) current_pad = i;
  }
  if (pads[PAD_M]> HIT_THRESHOLD && pads[PAD_R] > HIT_THRESHOLD) {
    set_game(MENU_GAME);
    return;
  }

  counter = pads[current_pad];
  matrix.print(counter);
  for(uint16_t i=0; i<strip.numPixels(); i++) {
      if (i<counter/m) {
         strip.setPixelColor(i, strip.Color(50,50,50));
      }
      else if (i== counter/m) { int v = (counter%m*5);
         strip.setPixelColor(i, strip.Color(v,v,v));}
         else {
           strip.setPixelColor(i,0);
         }
  }
  strip.show();
  matrix.writeDisplay();
  if (counter >= strip.numPixels() || counter == 0) d*=-1;
}

void calibrate_menu() {
  matrix.writeDigitRaw(1, 0x39); // C
  matrix.writeDigitRaw(3, 0x77); // A
  matrix.writeDigitRaw(4, 0x38); // L
}

//----------------------------------------------------------------------
// FILL_IT  removed code due to post limit

//----------------------------------------------------------------------
// AIM  removed code due to post limit

//----------------------------------------------------------------------
// MINE  removed code due to post limit

//----------------------------------------------------------------------
// SPEED GAME removed code due to post limit

Hello Dircur,
Welcome to the forum.

For correctly posting your code on your first post and for taking on such a project as your first attempt ++Karma.

It would help if you would post a circuit diagram and some photos of what you have made. A photo of a hand drawn diagram is fine. How are we to know if the problem is in your circuitry if we can't see your circuitry?

I am using the online ide to validate and load the code with no errors, but I am not getting the startup sequence on the 7 segment display.

My thought when I read that is that maybe you think that because it compiles with no errors that means there is nothing wrong with your code. In case you do think that; no. It means that the code is correct as far as the rules of C++ are concerned, it doesn't mean it does what you want it to do.

I've attached 2 pics the first is the Mish mash I have created, the second is the diagram from the blinken bonken tutorial. (The pics were too big I will make a second post.)

What I am trying to find is a terminal window where I can potentially watch the code or check pin states.

Is there an emulator available for testing/debugging code.

Is there a way for me to get pin states while it is running, from a terminal window.

I'm throwing all this out there, while sitting on a bucket in my garage.

Lowered res so I could post the images.

Again thanks for any help.

I think I am going to drop it to one game first and then see where I get.

dircur:
What I am trying to find is a terminal window where I can potentially watch the code or check pin states.

There's Serial.begin(xxxx); and its offspring Serial.Print(); and Serial.Println(); to display values to the serial monitor, which is a window that opens when you click the magnifying glass in the upper right of the IDE. See IDE -> file/examples/basics/digitalreadserial.

Make sure the baud rates match between Serial.begin(xxx); and the serial monitor.

Thanks,

Recognizing that I stepped a little too far by assuming everything would go tickity boo. I am stepping back.
I loaded the demo 7 segment sketch, disconnected the other leds and pads.
and was able to run the demo... so my 7 segment wiring is good. I am going to do the same with the leds, then the pads.
Once I am confident the the wiring works independent of each other, I will try to combined them (the demo's) with all the wiring.
Once I am confident all the wiring is good, I will attempt to build a simplified version of blinken bonken... light for 5 if hit detected.

Hopefully that will get my head far enough into the code to recognize if I did anything wrong with the augmenting zippy's code for 5 targets.

should I post progress? or just mark solved. not sure of forum etiquette here.

One thing..
I have a 30 amp 5v power supply. When I bread boarded the led with power from the 5v from the usb only everything worked. As I have a bunch of other LEDs I figured I need the extra power hence the larger supply. For my actual setup I am running the power directly to the arduino board via the 5v and gnd pins . When I was testing my wiring (powering the board from the usb) I purposely disconnected those power outs that I was using as in. My 7 seg was getting power from the supply but the io from the board.. it didn't work. I disconnected the usb, added the line ins to the board and it did. So clearly I got something odd going on there

dircur:
should I post progress? or just mark solved. not sure of forum etiquette here.

One thing..
I have a 30 amp 5v power supply. When I bread boarded the led with power from the 5v from the usb only everything worked. As I have a bunch of other LEDs I figured I need the extra power hence the larger supply. For my actual setup I am running the power directly to the arduino board via the 5v and gnd pins . When I was testing my wiring (powering the board from the usb) I purposely disconnected those power outs that I was using as in. My 7 seg was getting power from the supply but the io from the board.. it didn't work. I disconnected the usb, added the line ins to the board and it did. So clearly I got something odd going on there

I'd suggest leaving this thread open - better than starting a new thread for an issue related to this project. Posting progress is optional. Once it's working and no more questions you can edit the title of the first post to include [SOLVED] (see the 'more' button lower right of your post).

When using separate power supplies it's required to have all the grounds tied together to give a 'common' point of reference. And, if it gets to the point of voltages higher than +5V some measures need to be taken to protect the Arduino chip from such.

dircur:
Thanks,

Recognizing that I stepped a little too far by assuming everything would go tickity boo. I am stepping back.
I loaded the demo 7 segment sketch, disconnected the other leds and pads.
and was able to run the demo... so my 7 segment wiring is good. I am going to do the same with the leds, then the pads.
Once I am confident the the wiring works independent of each other, I will try to combined them (the demo's) with all the wiring.
Once I am confident all the wiring is good, I will attempt to build a simplified version of blinken bonken... light for 5 if hit detected.

Hopefully that will get my head far enough into the code to recognize if I did anything wrong with the augmenting zippy's code for 5 targets.

should I post progress? or just mark solved. not sure of forum etiquette here.

One thing..
I have a 30 amp 5v power supply. When I bread boarded the led with power from the 5v from the usb only everything worked. As I have a bunch of other LEDs I figured I need the extra power hence the larger supply. For my actual setup I am running the power directly to the arduino board via the 5v and gnd pins . When I was testing my wiring (powering the board from the usb) I purposely disconnected those power outs that I was using as in. My 7 seg was getting power from the supply but the io from the board.. it didn't work. I disconnected the usb, added the line ins to the board and it did. So clearly I got something odd going on there

Breaking it down into smaller chunks as you suggest is absolutely the right thing to do. While you don't have to post progress it is always interesting to see progress on projects I've made suggestions for.

The 2 photos you posted are the same image, and don't show everything, there are wires disappearing of the photo in all directions to I don't know what. A circuit diagram would help too. I realise you are new to this and please take this as intended to be constructive; your wiring is a mess. If it looks a mess then it is a mess. Tidy wiring is easier to follow and work out where the problems are, as well as looking a lot nicer.

Good luck!

Sorry about the duplicate pic. Attached is the wiring diagram for the 4 target version that I am adapting. I realize the the wiring was a mess and should have cleaned it up before posting.

I haven't had a chance to look at this again since Saturday hence the delay. Hoping to have a few hours tonight. I wouldn't have posted this were it not that I pooched posting the wiring diagram twice already

That's better!

Are the connections to your LED strip correct? In my limited experience LED strips have 0V and +5 at the edges with data in the middle. I am NOT saying the way you have them is definitely wrong, you probably have different strip to ones I have seen, but please check.

Once you have got it working and understand it make the following changes;
Instead of +5 to the targets with pull down resistors connect 0V to the targets and use the Uno's internal pull up resistors. Change the code to match. This won't fix any of the problems you are having, it's just the accepted proper way to do it. I suggest you don't do this change until you have it working because I don't want it to be something that confuses you unnecessarily.

I loaded the demo 7 segment sketch, disconnected the other leds and pads, and was able to run the demo... so my 7 segment display wiring is good.

Next step I suggest is to get the display to respond to changes at the inputs, maybe use something simple like a push button.

Please keep us updated on your progress, along with photos!

my whole goal is to give my son and his friends something fun to shoot at

Teach your kids how to Make, its a fun experience for everyone!

You are on the right track by breaking everything down, try testing your different components separately, and then combine them one at a time.

Here is the original DasBlinken image for those who don't want to download: