7 segment displays and 74HC595

Hello, i’m pretty new to arduino and i’m looking for some assistance with a project i’m working on. I’d like to build off of this:
http://www.geeetech.com/wiki/index.php/Arduino_7_segment_LED_timer_with_74HC595_module
i need four separate sets of 3 7 segment displays, one for showing the tilt values from an accelerometer right, one for left, forward and backaward, I have the reading of the sensors working great and i have no problem wiring things up myself, I just need help with the coding, what would be the best way to code this? I read values between +/- 32,000 for each axis, and i want to scale that down to 200. So for example if I read +15,000 on the y axis, one of the sets of 3 displays would read 0.93, and if i read -15,000 on the y axis a different set of 3 displays would read 0.93. i’d just duplicate the code and modify it a bit to do the exact same thing with the x axis and the other 2 sets of displays. This is what i have been using for only reading the sensors(I’m not using the gyro.):

// MPU-6050 Short Example Sketch
// By Arduino User JohnChi
// August 17, 2014
// Public Domain
#include<Wire.h>
const int MPU=0x68;  // I2C address of the MPU-6050
int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;

void setup(){
  Wire.begin();
  Wire.beginTransmission(MPU);
  Wire.write(0x6B);  // PWR_MGMT_1 register
  Wire.write(0);     // set to zero (wakes up the MPU-6050)
  Wire.endTransmission(true);
  Serial.begin(9600);
}
void loop(){
  Wire.beginTransmission(MPU);
  Wire.write(0x3B);  // starting with register 0x3B (ACCEL_XOUT_H)
  Wire.endTransmission(false);
  Wire.requestFrom(MPU,14,true);  // request a total of 14 registers
  AcX=Wire.read()<<8|Wire.read();  // 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L)     
  AcY=Wire.read()<<8|Wire.read();  // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L)
  AcZ=Wire.read()<<8|Wire.read();  // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L)
  Tmp=Wire.read()<<8|Wire.read();  // 0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L)
  GyX=Wire.read()<<8|Wire.read();  // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L)
  GyY=Wire.read()<<8|Wire.read();  // 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L)
  GyZ=Wire.read()<<8|Wire.read();  // 0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L)
  Serial.print("AcX = "); Serial.print(AcX);
  Serial.print(" | AcY = "); Serial.print(AcY);
  Serial.print(" | AcZ = "); Serial.print(AcZ);
  Serial.print(" | Tmp = "); Serial.print(Tmp/340.00+36.53);  //equation for temperature in degrees C from datasheet
  Serial.print(" | GyX = "); Serial.print(GyX);
  Serial.print(" | GyY = "); Serial.print(GyY);
  Serial.print(" | GyZ = "); Serial.println(GyZ);
  delay(3);
  
}

Suggest you do not waste your time with 74HC595s and buffer transistors (to get sufficient current) and multiplexing in software.

Just get a proper self-multiplexed display module like this one or if you can stand the delay, even cheaper ones on eBay (using this driver).

Hi, it would be much simpler to display all the values on a 16x2 lcd. What's the reason for wanting so many separate led displays?

Paul

Crap.. I already have all my hardware. I want to set up the displays exactly how I want them, in a cross pattern like this:

888 888 888 888

Can you tell us exactly what hardware you have got (with links please), and how you intended it to work. Have you drawn up a schematic, even on paper?

Also is the Arduino going to be doing anything else except reading the sensor and displaying the values?

Yes, i'm building a G-Meter for my friends Toyota Supra, there will be a "cross" of 7 segment displays like i showed, as well as a separate cross of 10 rgb leds driven by W2811 breakout boards, those are currently working correctly. there will be multiple pushbuttons controlling the saving and resetting of maximum values read in each direction as well as other software functions that i'll tackle very last when i get the hardware set up and working. this will all be controlled by an arduino nano. I have: MPU-6050 Gyro/Accelerometer on a GY-521 (already have the reading of the sensors working well) http://www.ebay.com/itm/GY-521-MPU-6050-Module-3-Axis-gyro-3-Axis-Accelerometer-Module-For-Arduino-/231214060723?pt=LH_DefaultDomain_0&hash=item35d56e94b3 12 small 7-segment displays http://www.digikey.com/product-search/en?KeyWords=160-1527-5-ND&WT.z_header=search_go Standard 74HC595 shift registers to control the 7 segment displays http://www.digikey.com/product-detail/en/SN74HC595N/296-1600-5-ND/277246 I'm using these for the rgb leds with some standard common anode rgb leds http://www.ebay.com/itm/271529951871?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

So connect each display to a '595 with current limit resistor per segment, daisychain the '595s, and send data to them using a simple for loop with SPI commands:

digitalWrite (ssPin, LOW);
for (x=0; x<12; x=x+1){
SPI.transfer(Tdisplay[x]);
}
digitalWrite (ssPin, HIGH); // outputs update on  this rising edge

Make sure you have 0.1uF cap to Gnd on each shift register’s VCC pin.

Ok, so i'm still confused as to what else I need in my code for everything to work, where do I put the "int" values i'm trying to show? Do i need to use a font array to tell the shift registers what individual leds to turn on and off? The X and Y axes are called AcX and AcY in my sketch.

In my example, they would go in the Tdisplay[] array. One byte per display. 0-9 for values usually. Can be letters too: A b C c d E e F g H I J L O P S T (sort of) U u Y (sort of) - , ' Use your imagination Are you displaying numbers? Then a fontArray[] would be used.

SPI.transfer(fontArray[Tdisplay[x]]); // double look up! Value of Tdisplay[x] gets mapped into the 7-segment
byte fontArray[]= {
0b00111111, // 0
0b00000110, // 1
//etc.
};

with each byte: DP-g-f-e-d-c-b-a 0 = segment off, 1 = segment on and standard 7-segment layout a f b g e c d DP