Display Serial Monitor on LED Matrix

How can I display this code:

/*

An open-source LM35DZ Temperature Sensor for Arduino. (cc) by Daniel Spillere Andrade

*/ 

int pin = 0; // analog pin
int tempc = 0,tempf=0; // temperature variables
int samples[8]; // variables to make a better precision
int maxi = -100,mini = 100; // to start max/min temperature
int i;

void setup()
{
 Serial.begin(9600); // start serial communication
}

void loop()
{
 
 
for(i = 0;i<=7;i++){ // gets 8 samples of temperature
 
 samples[i] = ( 5.0 * analogRead(pin) * 100.0) / 1024.0;
 tempc = tempc + samples[i];
 delay(1000);

}

tempc = tempc/8.0; // better precision
tempf = (tempc * 3)/ 5 + 32; // converts to fahrenheit

if(tempc > maxi) {maxi = tempf;} // set max temperature
if(tempc < mini) {mini = tempf;} // set min temperature


Serial.print(tempf,DEC);
Serial.print(" fahrenheit");


tempc = 0;

delay(1000); // delay before loop
}

As the displayed text in this code:

/*
Copyright (C) 2010 Adam Thomas

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/
#include <ht1632.h>
#include "font.h"
#include <stdlib.h> 

#include <MHV_io_ArduinoDuemilanove328p.h>

void * operator new(size_t size); 
void operator delete(void * ptr); 

void * operator new(size_t size) { 
  return malloc(size); 
} 

void operator delete(void * ptr) { 
  free(ptr); 
} 

uint8_t revbits(uint8_t arg) { 
  uint8_t result=0;
  if (arg & (_BV(0))) result |= _BV(7); 
  if (arg & (_BV(1))) result |= _BV(6); 
  if (arg & (_BV(2))) result |= _BV(5); 
  if (arg & (_BV(3))) result |= _BV(4); 
  if (arg & (_BV(4))) result |= _BV(3); 
  if (arg & (_BV(5))) result |= _BV(2); 
  if (arg & (_BV(6))) result |= _BV(1); 
  if (arg & (_BV(7))) result |= _BV(0); 
  return result;
}

HT1632 *matrix[4];

uint8_t max_cols = 127;
int16_t col_offset = max_cols;

HT1632 *cur_mat = 0;
char *string = "Welcome to Make, Hack, Void. Have a safe and productive day.";
char *first_char = string;
uint8_t first_char_col = 0;
char *cptr = first_char;
uint8_t char_col = first_char_col;

void setup ()
{  
  digitalWrite(4,HIGH);
  digitalWrite(5,HIGH);
  digitalWrite(6,HIGH);
  digitalWrite(7,HIGH);
  
  matrix[0] = new HT1632( MHV_ARDUINO_PIN_4,MHV_ARDUINO_PIN_8,MHV_ARDUINO_PIN_10,MHV_ARDUINO_PIN_9, HT1632::pmos_8commons );
  matrix[1] = new HT1632( MHV_ARDUINO_PIN_5,MHV_ARDUINO_PIN_8,MHV_ARDUINO_PIN_10,MHV_ARDUINO_PIN_9, HT1632::pmos_8commons, false );
  matrix[2] = new HT1632( MHV_ARDUINO_PIN_6,MHV_ARDUINO_PIN_8,MHV_ARDUINO_PIN_10,MHV_ARDUINO_PIN_9, HT1632::pmos_8commons, false );
  matrix[3] = new HT1632( MHV_ARDUINO_PIN_7,MHV_ARDUINO_PIN_8,MHV_ARDUINO_PIN_10,MHV_ARDUINO_PIN_9, HT1632::pmos_8commons, false );
}

void loop ()
{
  uint8_t char_index, char_width;      
  uint16_t char_offset;
  uint8_t first_char_width;

  if( *first_char > DEDP105_FONT_FIRST_CHAR + DEDP105_FONT_CHAR_COUNT || *first_char < DEDP105_FONT_FIRST_CHAR ) {
    char_index = DEDP105_FONT_CHAR_UNKNOWN;
  } else {
    char_index = *first_char - DEDP105_FONT_FIRST_CHAR;
  }
         
  first_char_width = pgm_read_byte( &dedp105_font_widths[char_index] );
  
  if( col_offset < 0 ) {
    if( ++first_char_col > first_char_width ) {
      first_char_col = 0;
    
      if( *(++first_char) == '\0' ) {
        first_char = string;
        col_offset = max_cols;
      }
      if( *first_char > DEDP105_FONT_FIRST_CHAR + DEDP105_FONT_CHAR_COUNT || *first_char < DEDP105_FONT_FIRST_CHAR ) {
        char_index = DEDP105_FONT_CHAR_UNKNOWN;
      } else {
        char_index = *first_char - DEDP105_FONT_FIRST_CHAR;
      }
         
      first_char_width = pgm_read_byte( &dedp105_font_widths[char_index] );
    }
  }
  cptr = first_char;
  char_col = first_char_col;
  char_width = first_char_width;
  char_offset = pgm_read_word(&dedp105_font_offsets[char_index]);
  
  
  uint8_t pixels;
  
  for( byte col = 0; col < max_cols+1; ++col ) {
    switch(col) {
      case 0:
      case 32:
      case 64:
      case 96:
        if( cur_mat )
          cur_mat->deselect();
        cur_mat = matrix[(int)(col/32)];
        cur_mat->set_mode( HT1632::write_mode );
        cur_mat->send_address( 0 );
      break;
    }
    if( cur_mat ) {
      pixels = 0;
      if( col_offset < col && *cptr != '\0' ) {
        
        if( char_col < char_width ) {
          pixels = pgm_read_byte(&dedp105_font[(int)(char_offset + char_col)]);
        }
  
        ++char_col;
  
        if( char_col > char_width ) {
          char_col = 0;
          cptr++;
          if( *cptr > DEDP105_FONT_FIRST_CHAR + DEDP105_FONT_CHAR_COUNT || *cptr < DEDP105_FONT_FIRST_CHAR ) {
            char_index = DEDP105_FONT_CHAR_UNKNOWN;
          } else {
            char_index = *cptr - DEDP105_FONT_FIRST_CHAR;
          }
  
          char_width = pgm_read_byte(&dedp105_font_widths[char_index]);
          char_offset = pgm_read_word(&dedp105_font_offsets[char_index]);
        }
      }
      cur_mat->send_data(pixels);
      cur_mat->send_data(pixels>>4);
    }
  }
  col_offset--;
}

Can you be a bit less cryptic about what you want to do?

The code you want to display is inside your computer it is not inside the arduino. The code gets compiled into machine code and transferred to the arduino so there is no way it can drive an LED matrix to show it.

Do you want a system to display a text file you send it from your PC with the arduino controlling the LED matrix?

Right now I have the temperature from a thermistor (code 1) displaying in the serial monitor. I want to use that text in place of the text that is displayed on the matrix in the second code.

Serial.print(tempf,DEC);
Outputs the data to the serial port.
Use the data output not to print but to build up a string that replaces this string:-
char *string = "Welcome to Make, Hack, Void. Have a safe and productive day.";
Then let the matrix code display it.
You need to look up how to handle strings and how to build them up.

What I want to do is display the temperature on an led matrix. I have a lm34 and an 0832 green led matrix. Can run both codes by themselves perfectly but I wand to be able to replace "Welcome to Make, Hack, Void. Have a safe and productive day." with the temperature that is at the moment being displayed in the Serial Monitor.

but I wand to be able to replace "Welcome to Make, Hack, Void. Have a safe and productive day." with the temperature that is at the moment being displayed in the Serial Monitor.

So, go ahead.

It's really time that you learned to do some simple things on your own.

Well, I'd simplify the code in the thermistor sketch (get rid of the "samples" array - it isn't used, get rid of the delay, get rid of the max/min code - it isn't used, use a proper unit, so ditch the Fahrenheit rubbish) so that you've got a simple function that returns the temperature.

Use something like "sprintf" to convert the number representation of the temperature into an ASCII string.

Display the string on the matrix, as suggested above.

Job done.

Ok, so on my own I have set up a DS 1307 RTC on my Arduino. I have it displaying the date and time via serial monitor. How can I basically view the serial monitor on a led matrix?

How can I basically view the serial monitor on a led matrix?

Replace Serial.print with functions to write to your led matrix.

Korman

Sorry if Im bothering you, but can you explain in a little more detail or give me an example. Thanks