Interfacing with SureElectronics 40-Segment LEDBar

I purchase one of SureElectronic's 40Segment Bar graph on ebay this fall and i've finally got some time to fool around with it yet it's getting the better of me. They have very good documentation on it, I can't find a link to the documents on the site I can't find the product either, but trust me it does exist :wink:
They provide sample code to get it to work with a Pic but I don't use pic I use arduino so that is no help to me. here is the Pic code they provide.

#include <pic.h> 
 
__CONFIG(UNPROTECT&MCLRDIS&WDTDIS); //Configure Word 
 
#define Fuc_key  GP3 
#define DIMM  GP2  
#define CLK   GP1 
#define DATA  GP0 
 
unsigned char time; 
unsigned char position; 
unsigned char key_pressed,last_key_pressed; 
 
void delay_20ms(void) 
{ 
 unsigned char i, j, k; 
 for(i = 0; i < 20; i++) 
 { 
  for(j = 0; j < 200; j++) 
   k--; 
 } 
} 
 
void SEG_Shift1(void) 
{ 
 unsigned char i; 
 position++; 
 if(position>40)position=0; 
 
 for(i = 0;i < 40; i++)    
 { 
  if(i==position) DATA=0; 
  else DATA = 1; 
  CLK = 0; 
  CLK = 1; 
 } 
} 
void SEG_Shift2(void) 
{ 
 unsigned char i; 
 position++; 
 for(i = 0;i < position; i++)    
 { 
  DATA = 1; 
  CLK = 0; 
  CLK = 1; 
 } 
 for(i = 0;i < (40-position); i++)    
 { 
  DATA = 0; 
  CLK = 0; 
  CLK = 1; 
 } 
 if(position>40)position=0; 
} 
void SEG_Shift3(void) 
{ 
 unsigned char i; 
 position++; 
 for(i = 0;i < (40-position); i++)    
 { 
  DATA = 1; 
  CLK = 0; 
  CLK = 1; 
 } 
 for(i = 0;i < position; i++)    
 { 
  DATA = 0; 
  CLK = 0; 
  CLK = 1; 
 } 
 if(position>40)position=0; 
} 
 
void change(void) 
{ 
 key_pressed=Fuc_key; 
 if((key_pressed==0)&(last_key_pressed==1))   
 { 
  if(key_pressed==0) 
  { 
   time++; 
   if(time>3)time=1; 
  } 
 }   
 last_key_pressed=key_pressed; 
} 
 
void main(void) 
{ 
 OSCCAL=0; 
 TRIS = 0b11111000; 
 OPTION=0b10011111; 
 
 while(1) 
 { 
  change(); 
  if(time==1)SEG_Shift1(); 
  if(time==2)SEG_Shift2(); 
  if(time==3)SEG_Shift3(); 
  delay_20ms(); 
 } 
}

Anyone want to give a try at porting this for the arduino?

http://www.sureelectronics.net/goods.php?id=139
http://www.sureelectronics.net/pdfs/DE-DP011.pdf

The circuit uses 74hc164 shift registers, which are somewhat similar to the 74hc595 that you should be able to find lots of tutorials on how to use it. I also found this bit of code:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1202874493

It might be obvious to you, but if you're using the Arduino, you don't need a custom time-waster loop like delay_20ms(). Just use delay(20).

This is also safer, as some compilers will spot the useless loop and unroll or optimize it all away, leaving you with k -= 40000 and a warning that you never initialized k. :wink:

I figured out how to get it to work! I'll post the code once I've cleaned it up it's right now just in prototype mode. It was a lot easier then I imagined. Even easier then using the ShiftOut function.

I have the exact same board, and i am having trouble getting it going.

would you share your code please?