Need help combining too sketches to use data from a tmp36 to read in morse.

I combined two sketches and right now it is error free and works printing the information to the serial monitor. It will print out the sample text I choose in the sketch and then print the temperature in the serial monitor. What I am trying to accomplish is to get the LED to also blink the temperature in morse code. Not really sure how to go about it. I am using a tmp36 for the sensor. Any ideas on how to accomplish this?

struct t_mtab { char c, pat; } ;

struct t_mtab morsetab[] = {
  	{'.', 106},
	{',', 115},
	{'?', 76},
	{'/', 41},
	{'A', 6},
	{'B', 17},
	{'C', 21},
	{'D', 9},
	{'E', 2},
	{'F', 20},
	{'G', 11},
	{'H', 16},
	{'I', 4},
	{'J', 30},
	{'K', 13},
	{'L', 18},
	{'M', 7},
	{'N', 5},
	{'O', 15},
	{'P', 22},
	{'Q', 27},
	{'R', 10},
	{'S', 8},
	{'T', 3},
	{'U', 12},
	{'V', 24},
	{'W', 14},
	{'X', 25},
	{'Y', 29},
	{'Z', 19},
	{'1', 62},
	{'2', 60},
	{'3', 56},
	{'4', 48},
	{'5', 32},
	{'6', 33},
	{'7', 35},
	{'8', 39},
	{'9', 47},
	{'0', 63}
} ;

#define N_MORSE  (sizeof(morsetab)/sizeof(morsetab[0]))

#define SPEED  (13)
#define DOTLEN  (1200/SPEED)
#define DASHLEN  (3*(1200/SPEED))


int LEDpin = 13 ;
int sensorPin = 0;
void
dash()
{
  digitalWrite(LEDpin, HIGH) ;
  delay(DASHLEN);
  digitalWrite(LEDpin, LOW) ;
  delay(DOTLEN) ;
}

void
dit()
{
  digitalWrite(LEDpin, HIGH) ;
  delay(DOTLEN);
  digitalWrite(LEDpin, LOW) ;
  delay(DOTLEN);
}

void
send(char c)
{
  int i ;
  if (c == ' ') {
    Serial.print(c) ;
    delay(7*DOTLEN) ;
    return ;
  }
  for (i=0; i<N_MORSE; i++) {
    if (morsetab[i].c == c) {
      unsigned char p = morsetab[i].pat ;
      Serial.print(morsetab[i].c) ;

      while (p != 1) {
          if (p & 1)
            dash() ;
          else
            dit() ;
          p = p / 2 ;
      }
      delay(2*DOTLEN) ;
      return ;
    }
  }
  
  Serial.print("?") ;
}

void

sendmsg(char *str)

{
  while (*str)
    send(*str++) ;
  Serial.println("");
}


void setup()  
{
  pinMode(LEDpin, OUTPUT) ;
  Serial.begin(9600) ;
 
}


void loop()   
{
  
  int reading = analogRead(sensorPin);

  float voltage = reading * 5.0;
 voltage /= 1024.0; 

 float temperatureC = (voltage - 0.5) * 100 ;  
int temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
 Serial.print(temperatureF); Serial.println("F");
 
 delay(1000);                                     
 sendmsg("SAMPLE TEXT");
  delay(2000) ;
 
 
  
  

  

}

Forgot was in a hurry

Now, without italics, please.

You have not done yourself, or anyone else, any favours by not using code tags when you posted your code. As a result much of it is in italics, the most common cause of which is using i as an index to an array. This is seen by the forum software as an italics tag which causes all subsequent text to be shown in italics.

Please edit your post to use code tags.

Any ideas on how to accomplish this?

You have a good start, but it is important to understand what each part of the code does. Once you've gone through the code and understood the sections (feel free to post questions about the details to the forum), then you need to formulate a plan of action and write the code accordingly. The obvious outline for the main loop is

  1. read the temperature
  2. convert the temperature into a format suitable for Morse code (two digits, perhaps?)
  3. call the Morse code routines to transmit the temperature
  4. repeat
  1. convert the temperature into a format suitable for Morse code (two digits, perhaps?)

Or a string, using itoa() or dtostrf(), depending on how accurate your sensor REALLY is.

Study other Threads about similar problems.

...R