Use of SparkFun Serial 7-Segment Display with Arduino

Hello All,


I am doing a project for my senior year of college and I am struggling with getting my 7-segment display to work. Specifically I have 7-segment serial display this display. I am capable of using the sample code and I now understand how it works but when I try and apply it to my project I am not getting any displayed numbers.

Specifically for my project I am trying to display a percentage on this display. the way I have it set up is that this percentage is an integer. Here is where I may have my error. The print function for this display wants a string instead of an integer, but when I try and use the String() function to convert this integer to a string, I still get no results. I am posting my code below hoping that I can get some wisdom on how I can get this display to work.

Another bit of info is that in my code, I have a “HELP” displayed before the real functioning of the device should occur. This HELP is displayed but then the rest of the time the display is blank… Any help would be greatly appreciated.

Here is my code.

#include <SPI.h>

int inWt = 30.;/*input the patient weight here as a whole number*/
int threshPerc = 5.;/*input the threshold percentage for the patient*/ 

const int ssPin = 8;  //Pin for the display
int fsrPin1 = 0;     // FSR for sensor 1
int fsrPin2 = 1;     // FSR for sensor 2
int fsrPin3 = 2;     // FSR for sensor 3 
int fsrReading;     // the analog reading from the FSR resistor divider


void setup(){

  // -------- SPI initialization
  pinMode(ssPin, OUTPUT);  // Set the SS pin as an output
  digitalWrite(ssPin, HIGH);  // Set the SS pin HIGH
  SPI.begin();  // Begin SPI hardware
  SPI.setClockDivider(SPI_CLOCK_DIV64);  // Slow down SPI clock
  // --------

  // Clear the display, and then turn on all segments and decimals
  clearDisplaySPI();  // Clears display, resets cursor

  // Custom function to send four bytes via SPI
  //  The SPI.transfer function only allows sending of a single
  //  byte at a time.
  setDecimalsSPI(0b111111);  // Turn on all decimals, colon, apos

  // Flash brightness values at the beginning
  setBrightnessSPI(0);  // Lowest brightness
  setBrightnessSPI(255);  // High brightness

  // Clear the display before jumping into loop
void loop(void) {
  int fsrReading1 = analogRead(fsrPin1); 
  int fsrReading2 = analogRead(fsrPin2); 
  int fsrReading3 = analogRead(fsrPin3); 
  double convWt1 = convWeight(fsrReading1);              //Implementing the conversion equation
  int patWt = inWt/*inputted patient weight*/;       //THIS IS WHERE GUI GOES FOR PATIENT WEIGHT
  int perc1 = convWt1/patWt*100.0;                 //creating the percentage
  double convWt2 = convWeight(fsrReading2);              //Implementing the conversion equation
  int perc2 = convWt2/patWt*100.0;                 //creating the percentage
  double convWt3 = convWeight(fsrReading3);              //Implementing the conversion equation
  int perc3 = convWt3/patWt*100.0;                 //creating the percentage
  int totalWt = (convWt1+convWt2+convWt3)/(3.);
  int totalPerc = (perc1+perc2+perc3)/(3.);
  if (totalPerc > threshPerc/*inputted threshold from caregiver*/){        //THIS IS WHERE GUI GOES THRESHOLD
    if (totalPerc < threshPerc/*inputted threshold from caregiver*/ - 5){
  } else {
    noTone (6);            // This is alarm if statement
  Serial.print("Analog reading = ");
  Serial.println(totalPerc);     //This is printing analog reading, conversion weight, percentage weight
 char buf[10];
 s7sSendStringSPI(String(totalPerc));        // This is where the percent would be sent to display

 double convWeight(int Reading){
  return  exp(0.0059*Reading); // calibration curve function
// This custom function works somewhat like a serial.print.
//  You can send it an array of chars (string) and it'll print
//  the first 4 characters in the array.
void s7sSendStringSPI(String toSend)
  digitalWrite(ssPin, LOW);
  for (int i=0; i<4; i++)
  digitalWrite(ssPin, HIGH);

// Send the clear display command (0x76)
//  This will clear the display and reset the cursor
void clearDisplaySPI()
  digitalWrite(ssPin, LOW);
  SPI.transfer(0x76);  // Clear display command
  digitalWrite(ssPin, HIGH);

// Set the displays brightness. Should receive byte with the value
//  to set the brightness to
//  dimmest------------->brightest
//     0--------127--------255
void setBrightnessSPI(byte value)
  digitalWrite(ssPin, LOW);
  SPI.transfer(0x7A);  // Set brightness command byte
  SPI.transfer(value);  // brightness data byte
  digitalWrite(ssPin, HIGH);

void setDecimalsSPI(byte decimals)
  digitalWrite(ssPin, LOW);
  digitalWrite(ssPin, HIGH);