Need to find DMD with temp only

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
vrooms23
Posts:38
Joined:Sun Jun 30, 2013 9:23 am
Need to find DMD with temp only

Post by vrooms23 » Mon Jul 22, 2013 2:00 pm

Anyone have only just temp DS18B20 with DMD?

andrew
Freetronics Staff
Freetronics Staff
Posts:978
Joined:Sun Jul 14, 2013 7:06 am
Location:Melbourne, Australia
Contact:

Re: Need to find DMD with temp only

Post by andrew » Mon Jul 22, 2013 11:31 pm

Examine the following sketch. Change it so the value for t comes from a DS18b20 not a DHT22

Code: Select all

// DHT22>DMD temperature display
// John Boxall 2013 

float t; // holds temperature value
String finalString; // used to hold final sentence to display on DMD

// connect the HUMID: to 5V, GND and D3
#include "DHT.h"
DHT dht(3, DHT22);

// for Freetronics DMD
#include <SPI.h>      
#include <DMD.h>      
#include <TimerOne.h> 
#include "SystemFont5x7.h"
#include "Arial_black_16.h"
#define DISPLAYS_ACROSS 1 // you could have more than one DMD in a row
#define DISPLAYS_DOWN 1
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);

void ScanDMD() // required for DMD
{ 
  dmd.scanDisplayBySPI();
}

int round5(float n)
{
  float a;
  int b;
  a = ((n/0.50)+0.5);
  b = int (a);
  b = b * 0.50;
  return b;
}

void drawText(String oldString) 
{
  //Clear the panel
  dmd.clearScreen(true);
  //Select font
  //dmd.selectFont(System5x7);
  dmd.selectFont(Arial_Black_16);
  char newString[256];
  int sLength = oldString.length();
  oldString.toCharArray(newString, sLength+1);
  dmd.drawMarquee(newString,sLength,(32*DISPLAYS_ACROSS)-1,0);
  long start=millis();
  long timer=start;
  long timer2=start;
  boolean ret=false;
  while(!ret){
    if ((timer+40) < millis()) {  //Select speed
      ret=dmd.stepMarquee(-1,0);
      timer=millis();
    }
  }
}

void createTextTemp()
// this mashes up all the temprature data into text 
{
  Serial.println("createTextTime()"); // for debug

  finalString=" "; // wipe the sentence out for special cases (below)
  finalString=finalString+"It's ";

  // add the list of numbers from -10.50 to 55.50
  if (t<=-10.50) { 
    finalString=finalString+"COLD "; 
  } 
  if (t==-10.00) { 
    finalString=finalString+"-10 "; 
  } 
  if (t==-9.50) { 
    finalString=finalString+"-9.5 "; 
  } 
  if (t==-9.00) { 
    finalString=finalString+"-9.0 "; 
  } 
  if (t==-8.50) { 
    finalString=finalString+"-8.5 "; 
  } 
  if (t==-8.00) { 
    finalString=finalString+"-8 "; 
  } 
  if (t==-7.50) { 
    finalString=finalString+"-7.5 "; 
  } 
  if (t==-7.00) { 
    finalString=finalString+"-7 "; 
  } 
  if (t==-6.50) { 
    finalString=finalString+"-6.5 "; 
  } 
  if (t==-6.00) { 
    finalString=finalString+"-6 "; 
  } 
  if (t==-5.50) { 
    finalString=finalString+"-5.5 "; 
  } 
  if (t==-4.50) { 
    finalString=finalString+"-4.5 "; 
  } 
  if (t==-4.00) { 
    finalString=finalString+"-4 "; 
  } 
  if (t==-3.50) { 
    finalString=finalString+"-3.5 "; 
  } 
  if (t==-3.00) { 
    finalString=finalString+"-3 "; 
  } 
  if (t==-2.50) { 
    finalString=finalString+"-2.5 "; 
  } 
  if (t==-2.00) { 
    finalString=finalString+"-2 "; 
  } 
  if (t==-1.50) { 
    finalString=finalString+"-1.5 "; 
  } 
  if (t==-1.00) { 
    finalString=finalString+"-1 "; 
  } 
  if (t==0.00) { 
    finalString=finalString+"0 "; 
  } 
  if (t==0.50) { 
    finalString=finalString+"0.5 "; 
  } 
  if (t==1.00) { 
    finalString=finalString+"1 "; 
  } 
  if (t==1.50) { 
    finalString=finalString+"1.5 "; 
  } 
  if (t==2.00) { 
    finalString=finalString+"2 "; 
  } 
  if (t==2.50) { 
    finalString=finalString+"2.5 "; 
  } 
  if (t==3.00) { 
    finalString=finalString+"3 "; 
  } 
  if (t==3.50) { 
    finalString=finalString+"3.5 "; 
  } 
  if (t==4.00) { 
    finalString=finalString+"4 "; 
  } 
  if (t==4.50) { 
    finalString=finalString+"4.5 "; 
  } 
  if (t==5.00) { 
    finalString=finalString+"5 "; 
  } 
  if (t==5.50) { 
    finalString=finalString+"5.5 "; 
  } 
  if (t==6.00) { 
    finalString=finalString+"6 "; 
  } 
  if (t==6.50) { 
    finalString=finalString+"6.5 "; 
  } 
  if (t==7.00) { 
    finalString=finalString+"7 "; 
  } 
  if (t==7.50) { 
    finalString=finalString+"7.5 "; 
  } 
  if (t==8.00) { 
    finalString=finalString+"8 "; 
  } 
  if (t==8.50) { 
    finalString=finalString+"8.5 "; 
  } 
  if (t==9.00) { 
    finalString=finalString+"9 "; 
  } 
  if (t==9.50) { 
    finalString=finalString+"9.5 "; 
  } 
  if (t==10.00) { 
    finalString=finalString+"10 "; 
  } 
  if (t==10.50) { 
    finalString=finalString+"10.5 "; 
  } 
  if (t==11.00) { 
    finalString=finalString+"11 "; 
  } 
  if (t==11.50) { 
    finalString=finalString+"11.5 "; 
  } 
  if (t==12.00) { 
    finalString=finalString+"12 "; 
  } 
  if (t==12.50) { 
    finalString=finalString+"12.5 "; 
  } 
  if (t==13.00) { 
    finalString=finalString+"13 "; 
  } 
  if (t==13.50) { 
    finalString=finalString+"13.5 "; 
  } 
  if (t==14.00) { 
    finalString=finalString+"14 "; 
  } 
  if (t==14.50) { 
    finalString=finalString+"14.5 "; 
  } 
  if (t==15.00) { 
    finalString=finalString+"15 "; 
  } 
  if (t==15.50) { 
    finalString=finalString+"15.5 "; 
  } 
  if (t==16.00) { 
    finalString=finalString+"16 "; 
  } 
  if (t==16.50) { 
    finalString=finalString+"16.5 "; 
  } 
  if (t==17.00) { 
    finalString=finalString+"17 "; 
  } 
  if (t==17.50) { 
    finalString=finalString+"17.5 "; 
  } 
  if (t==18.00) { 
    finalString=finalString+"18 "; 
  } 
  if (t==18.50) { 
    finalString=finalString+"18.5 "; 
  } 
  if (t==19.00) { 
    finalString=finalString+"19 "; 
  } 
  if (t==19.50) { 
    finalString=finalString+"19.5 "; 
  } 
  if (t==20.00) { 
    finalString=finalString+"20 "; 
  } 
  if (t==20.50) { 
    finalString=finalString+"20.5 "; 
  } 
  if (t==21.00) { 
    finalString=finalString+"21 "; 
  } 
  if (t==21.50) { 
    finalString=finalString+"21.5 "; 
  } 
  if (t==22.00) { 
    finalString=finalString+"22 "; 
  }

  if (t==22.50) { 
    finalString=finalString+"22.5 "; 
  } 
  if (t==23.00) { 
    finalString=finalString+"23 "; 
  } 
  if (t==23.50) { 
    finalString=finalString+"23.5 "; 
  } 
  if (t==24.00) { 
    finalString=finalString+"24 "; 
  } 
  if (t==24.50) { 
    finalString=finalString+"24.5 "; 
  } 
  if (t==25.00) { 
    finalString=finalString+"25 "; 
  } 
  if (t==25.50) { 
    finalString=finalString+"25.5 "; 
  } 
  if (t==26.00) { 
    finalString=finalString+"26 "; 
  } 
  if (t==26.50) { 
    finalString=finalString+"26.5 "; 
  } 
  if (t==27.00) { 
    finalString=finalString+"27 "; 
  } 
  if (t==27.50) { 
    finalString=finalString+"27.5 "; 
  } 
  if (t==28.00) { 
    finalString=finalString+"28 "; 
  } 
  if (t==28.50) { 
    finalString=finalString+"28.5 "; 
  } 
  if (t==29.00) { 
    finalString=finalString+"29 "; 
  } 
  if (t==29.50) { 
    finalString=finalString+"29.5 "; 
  } 
  if (t==30.00) { 
    finalString=finalString+"30 "; 
  } 
  if (t==30.50) { 
    finalString=finalString+"30.5 "; 
  } 
  if (t==31.00) { 
    finalString=finalString+"31 "; 
  } 
  if (t==31.50) { 
    finalString=finalString+"31.5 "; 
  } 
  if (t==32.00) { 
    finalString=finalString+"32 "; 
  } 
  if (t==32.50) { 
    finalString=finalString+"32.5 "; 
  } 
  if (t==33.00) { 
    finalString=finalString+"33 "; 
  } 
  if (t==33.50) { 
    finalString=finalString+"33.5 "; 
  } 
  if (t==34.00) { 
    finalString=finalString+"34 "; 
  } 
  if (t==34.50) { 
    finalString=finalString+"34.5 "; 
  } 
  if (t==35.00) { 
    finalString=finalString+"35 "; 
  } 
  if (t==35.50) { 
    finalString=finalString+"35.5 "; 
  } 
  if (t==36.00) { 
    finalString=finalString+"36 "; 
  } 
  if (t==36.50) { 
    finalString=finalString+"36.5 "; 
  } 
  if (t==37.00) { 
    finalString=finalString+"37 "; 
  } 
  if (t==37.50) { 
    finalString=finalString+"37.5 "; 
  } 
  if (t==38.00) { 
    finalString=finalString+"38 "; 
  } 
  if (t==38.50) { 
    finalString=finalString+"38.5 "; 
  } 
  if (t==39.00) { 
    finalString=finalString+"39 "; 
  } 
  if (t==39.50) { 
    finalString=finalString+"39.5 "; 
  } 
  if (t==40.00) { 
    finalString=finalString+"40 "; 
  } 
  if (t==40.50) { 
    finalString=finalString+"40.5 "; 
  } 
  if (t==41.00) { 
    finalString=finalString+"41 "; 
  } 
  if (t==41.50) { 
    finalString=finalString+"41.5 "; 
  } 
  if (t==42.00) { 
    finalString=finalString+"42 "; 
  } 
  if (t==42.50) { 
    finalString=finalString+"42.5 "; 
  } 
  if (t==43.00) { 
    finalString=finalString+"43 "; 
  } 
  if (t==43.50) { 
    finalString=finalString+"43.5 "; 
  } 
  if (t==44.00) { 
    finalString=finalString+"44 "; 
  } 
  if (t==44.50) { 
    finalString=finalString+"44.5 "; 
  } 
  if (t==45.00) { 
    finalString=finalString+"45 "; 
  } 
  if (t==45.50) { 
    finalString=finalString+"45.5 "; 
  } 
  if (t==46.00) { 
    finalString=finalString+"46 "; 
  } 
  if (t==46.50) { 
    finalString=finalString+"46.5 "; 
  } 
  if (t==47.00) { 
    finalString=finalString+"47 "; 
  } 
  if (t==47.50) { 
    finalString=finalString+"47.5 "; 
  } 
  if (t==48.00) { 
    finalString=finalString+"48 "; 
  } 
  if (t==48.50) { 
    finalString=finalString+"48.5 "; 
  } 
  if (t==49.00) { 
    finalString=finalString+"49 "; 
  } 
  if (t==49.50) { 
    finalString=finalString+"49.5 "; 
  } 
  if (t==50.00) { 
    finalString=finalString+"50 "; 
  } 
  if (t==50.50) { 
    finalString=finalString+"50.5 "; 
  } 
  if (t==51.00) { 
    finalString=finalString+"51 "; 
  } 
  if (t==51.50) { 
    finalString=finalString+"51.5 "; 
  } 
  if (t==52.00) { 
    finalString=finalString+"52 "; 
  } 
  if (t==52.50) { 
    finalString=finalString+"52.5 "; 
  } 
  if (t==53.00) { 
    finalString=finalString+"53 "; 
  } 
  if (t==53.50) { 
    finalString=finalString+"53.5 "; 
  } 
  if (t==54.00) { 
    finalString=finalString+"54 "; 
  } 
  if (t==54.50) { 
    finalString=finalString+"54.5 "; 
  } 
  if (t==55.00) { 
    finalString=finalString+"55 "; 
  } 
  if (t==55.50) { 
    finalString=finalString+"55.5 "; 
  } 
  if (t>=55.50) { 
    finalString=finalString+"HOT "; 
  } 
  finalString=finalString+"*C ";
}

void setup()
{
  Serial.begin(9600);
  dht.begin();

  // for DMD
  Timer1.initialize( 5000 );
  Timer1.attachInterrupt( ScanDMD );   
  dmd.clearScreen(true);
}

void loop()
{
  // get the temperature and round it to nearest 5
  t=dht.readTemperature(); 
  t=round5(t);

  // now create the text to display on the DMD
  createTextTemp();

  // now send the text to the DMD
  drawText(finalString);
}


vrooms23
Posts:38
Joined:Sun Jun 30, 2013 9:23 am

Re: Need to find DMD with temp only

Post by vrooms23 » Tue Jul 23, 2013 11:05 am

Thanks, I got it, but not surely what mean, I need change libraries put like;
#include <OneWire.h>
#include <DallasTemperature.h>
? I have include them already for DS18B20.
remove include DHT?

andrew
Freetronics Staff
Freetronics Staff
Posts:978
Joined:Sun Jul 14, 2013 7:06 am
Location:Melbourne, Australia
Contact:

Re: Need to find DMD with temp only

Post by andrew » Tue Jul 23, 2013 11:17 pm

vrooms23 wrote:Thanks, I got it, but not surely what mean, I need change libraries put like;
#include <OneWire.h>
#include <DallasTemperature.h>
? I have include them already for DS18B20.
remove include DHT?
That's right - remove all the code related to the DHT and add the DS18B20 code. As an exercise for you the following sketch is ready - except it doesn't have any code for the DS18B20. You add that yourself. Then look for the line ending with @@@@@@@@@@@@@
At this point, you make t = the value from the DS18B20.

Try adding the code yourself and see how you go:

Code: Select all

// John Boxall 2013 

float t; // holds temperature value
String finalString; // used to hold final sentence to display on DMD

// for Freetronics DMD
#include <SPI.h>      
#include <DMD.h>      
#include <TimerOne.h> 
#include "SystemFont5x7.h"
#include "Arial_black_16.h"
#define DISPLAYS_ACROSS 1 // you could have more than one DMD in a row
#define DISPLAYS_DOWN 1
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);

void ScanDMD() // required for DMD
{ 
  dmd.scanDisplayBySPI();
}

int round5(float n)
{
  float a;
  int b;
  a = ((n/0.50)+0.5);
  b = int (a);
  b = b * 0.50;
  return b;
}

void drawText(String oldString) 
{
  //Clear the panel
  dmd.clearScreen(true);
  //Select font
  //dmd.selectFont(System5x7);
  dmd.selectFont(Arial_Black_16);
  char newString[256];
  int sLength = oldString.length();
  oldString.toCharArray(newString, sLength+1);
  dmd.drawMarquee(newString,sLength,(32*DISPLAYS_ACROSS)-1,0);
  long start=millis();
  long timer=start;
  long timer2=start;
  boolean ret=false;
  while(!ret){
    if ((timer+40) < millis()) {  //Select speed
      ret=dmd.stepMarquee(-1,0);
      timer=millis();
    }
  }
}

void createTextTemp()
// this mashes up all the temprature data into text 
{
  Serial.println("createTextTime()"); // for debug

  finalString=" "; // wipe the sentence out for special cases (below)
  finalString=finalString+"It's ";

  // add the list of numbers from -10.50 to 55.50
  if (t<=-10.50) { 
    finalString=finalString+"COLD "; 
  } 
  if (t==-10.00) { 
    finalString=finalString+"-10 "; 
  } 
  if (t==-9.50) { 
    finalString=finalString+"-9.5 "; 
  } 
  if (t==-9.00) { 
    finalString=finalString+"-9.0 "; 
  } 
  if (t==-8.50) { 
    finalString=finalString+"-8.5 "; 
  } 
  if (t==-8.00) { 
    finalString=finalString+"-8 "; 
  } 
  if (t==-7.50) { 
    finalString=finalString+"-7.5 "; 
  } 
  if (t==-7.00) { 
    finalString=finalString+"-7 "; 
  } 
  if (t==-6.50) { 
    finalString=finalString+"-6.5 "; 
  } 
  if (t==-6.00) { 
    finalString=finalString+"-6 "; 
  } 
  if (t==-5.50) { 
    finalString=finalString+"-5.5 "; 
  } 
  if (t==-4.50) { 
    finalString=finalString+"-4.5 "; 
  } 
  if (t==-4.00) { 
    finalString=finalString+"-4 "; 
  } 
  if (t==-3.50) { 
    finalString=finalString+"-3.5 "; 
  } 
  if (t==-3.00) { 
    finalString=finalString+"-3 "; 
  } 
  if (t==-2.50) { 
    finalString=finalString+"-2.5 "; 
  } 
  if (t==-2.00) { 
    finalString=finalString+"-2 "; 
  } 
  if (t==-1.50) { 
    finalString=finalString+"-1.5 "; 
  } 
  if (t==-1.00) { 
    finalString=finalString+"-1 "; 
  } 
  if (t==0.00) { 
    finalString=finalString+"0 "; 
  } 
  if (t==0.50) { 
    finalString=finalString+"0.5 "; 
  } 
  if (t==1.00) { 
    finalString=finalString+"1 "; 
  } 
  if (t==1.50) { 
    finalString=finalString+"1.5 "; 
  } 
  if (t==2.00) { 
    finalString=finalString+"2 "; 
  } 
  if (t==2.50) { 
    finalString=finalString+"2.5 "; 
  } 
  if (t==3.00) { 
    finalString=finalString+"3 "; 
  } 
  if (t==3.50) { 
    finalString=finalString+"3.5 "; 
  } 
  if (t==4.00) { 
    finalString=finalString+"4 "; 
  } 
  if (t==4.50) { 
    finalString=finalString+"4.5 "; 
  } 
  if (t==5.00) { 
    finalString=finalString+"5 "; 
  } 
  if (t==5.50) { 
    finalString=finalString+"5.5 "; 
  } 
  if (t==6.00) { 
    finalString=finalString+"6 "; 
  } 
  if (t==6.50) { 
    finalString=finalString+"6.5 "; 
  } 
  if (t==7.00) { 
    finalString=finalString+"7 "; 
  } 
  if (t==7.50) { 
    finalString=finalString+"7.5 "; 
  } 
  if (t==8.00) { 
    finalString=finalString+"8 "; 
  } 
  if (t==8.50) { 
    finalString=finalString+"8.5 "; 
  } 
  if (t==9.00) { 
    finalString=finalString+"9 "; 
  } 
  if (t==9.50) { 
    finalString=finalString+"9.5 "; 
  } 
  if (t==10.00) { 
    finalString=finalString+"10 "; 
  } 
  if (t==10.50) { 
    finalString=finalString+"10.5 "; 
  } 
  if (t==11.00) { 
    finalString=finalString+"11 "; 
  } 
  if (t==11.50) { 
    finalString=finalString+"11.5 "; 
  } 
  if (t==12.00) { 
    finalString=finalString+"12 "; 
  } 
  if (t==12.50) { 
    finalString=finalString+"12.5 "; 
  } 
  if (t==13.00) { 
    finalString=finalString+"13 "; 
  } 
  if (t==13.50) { 
    finalString=finalString+"13.5 "; 
  } 
  if (t==14.00) { 
    finalString=finalString+"14 "; 
  } 
  if (t==14.50) { 
    finalString=finalString+"14.5 "; 
  } 
  if (t==15.00) { 
    finalString=finalString+"15 "; 
  } 
  if (t==15.50) { 
    finalString=finalString+"15.5 "; 
  } 
  if (t==16.00) { 
    finalString=finalString+"16 "; 
  } 
  if (t==16.50) { 
    finalString=finalString+"16.5 "; 
  } 
  if (t==17.00) { 
    finalString=finalString+"17 "; 
  } 
  if (t==17.50) { 
    finalString=finalString+"17.5 "; 
  } 
  if (t==18.00) { 
    finalString=finalString+"18 "; 
  } 
  if (t==18.50) { 
    finalString=finalString+"18.5 "; 
  } 
  if (t==19.00) { 
    finalString=finalString+"19 "; 
  } 
  if (t==19.50) { 
    finalString=finalString+"19.5 "; 
  } 
  if (t==20.00) { 
    finalString=finalString+"20 "; 
  } 
  if (t==20.50) { 
    finalString=finalString+"20.5 "; 
  } 
  if (t==21.00) { 
    finalString=finalString+"21 "; 
  } 
  if (t==21.50) { 
    finalString=finalString+"21.5 "; 
  } 
  if (t==22.00) { 
    finalString=finalString+"22 "; 
  }

  if (t==22.50) { 
    finalString=finalString+"22.5 "; 
  } 
  if (t==23.00) { 
    finalString=finalString+"23 "; 
  } 
  if (t==23.50) { 
    finalString=finalString+"23.5 "; 
  } 
  if (t==24.00) { 
    finalString=finalString+"24 "; 
  } 
  if (t==24.50) { 
    finalString=finalString+"24.5 "; 
  } 
  if (t==25.00) { 
    finalString=finalString+"25 "; 
  } 
  if (t==25.50) { 
    finalString=finalString+"25.5 "; 
  } 
  if (t==26.00) { 
    finalString=finalString+"26 "; 
  } 
  if (t==26.50) { 
    finalString=finalString+"26.5 "; 
  } 
  if (t==27.00) { 
    finalString=finalString+"27 "; 
  } 
  if (t==27.50) { 
    finalString=finalString+"27.5 "; 
  } 
  if (t==28.00) { 
    finalString=finalString+"28 "; 
  } 
  if (t==28.50) { 
    finalString=finalString+"28.5 "; 
  } 
  if (t==29.00) { 
    finalString=finalString+"29 "; 
  } 
  if (t==29.50) { 
    finalString=finalString+"29.5 "; 
  } 
  if (t==30.00) { 
    finalString=finalString+"30 "; 
  } 
  if (t==30.50) { 
    finalString=finalString+"30.5 "; 
  } 
  if (t==31.00) { 
    finalString=finalString+"31 "; 
  } 
  if (t==31.50) { 
    finalString=finalString+"31.5 "; 
  } 
  if (t==32.00) { 
    finalString=finalString+"32 "; 
  } 
  if (t==32.50) { 
    finalString=finalString+"32.5 "; 
  } 
  if (t==33.00) { 
    finalString=finalString+"33 "; 
  } 
  if (t==33.50) { 
    finalString=finalString+"33.5 "; 
  } 
  if (t==34.00) { 
    finalString=finalString+"34 "; 
  } 
  if (t==34.50) { 
    finalString=finalString+"34.5 "; 
  } 
  if (t==35.00) { 
    finalString=finalString+"35 "; 
  } 
  if (t==35.50) { 
    finalString=finalString+"35.5 "; 
  } 
  if (t==36.00) { 
    finalString=finalString+"36 "; 
  } 
  if (t==36.50) { 
    finalString=finalString+"36.5 "; 
  } 
  if (t==37.00) { 
    finalString=finalString+"37 "; 
  } 
  if (t==37.50) { 
    finalString=finalString+"37.5 "; 
  } 
  if (t==38.00) { 
    finalString=finalString+"38 "; 
  } 
  if (t==38.50) { 
    finalString=finalString+"38.5 "; 
  } 
  if (t==39.00) { 
    finalString=finalString+"39 "; 
  } 
  if (t==39.50) { 
    finalString=finalString+"39.5 "; 
  } 
  if (t==40.00) { 
    finalString=finalString+"40 "; 
  } 
  if (t==40.50) { 
    finalString=finalString+"40.5 "; 
  } 
  if (t==41.00) { 
    finalString=finalString+"41 "; 
  } 
  if (t==41.50) { 
    finalString=finalString+"41.5 "; 
  } 
  if (t==42.00) { 
    finalString=finalString+"42 "; 
  } 
  if (t==42.50) { 
    finalString=finalString+"42.5 "; 
  } 
  if (t==43.00) { 
    finalString=finalString+"43 "; 
  } 
  if (t==43.50) { 
    finalString=finalString+"43.5 "; 
  } 
  if (t==44.00) { 
    finalString=finalString+"44 "; 
  } 
  if (t==44.50) { 
    finalString=finalString+"44.5 "; 
  } 
  if (t==45.00) { 
    finalString=finalString+"45 "; 
  } 
  if (t==45.50) { 
    finalString=finalString+"45.5 "; 
  } 
  if (t==46.00) { 
    finalString=finalString+"46 "; 
  } 
  if (t==46.50) { 
    finalString=finalString+"46.5 "; 
  } 
  if (t==47.00) { 
    finalString=finalString+"47 "; 
  } 
  if (t==47.50) { 
    finalString=finalString+"47.5 "; 
  } 
  if (t==48.00) { 
    finalString=finalString+"48 "; 
  } 
  if (t==48.50) { 
    finalString=finalString+"48.5 "; 
  } 
  if (t==49.00) { 
    finalString=finalString+"49 "; 
  } 
  if (t==49.50) { 
    finalString=finalString+"49.5 "; 
  } 
  if (t==50.00) { 
    finalString=finalString+"50 "; 
  } 
  if (t==50.50) { 
    finalString=finalString+"50.5 "; 
  } 
  if (t==51.00) { 
    finalString=finalString+"51 "; 
  } 
  if (t==51.50) { 
    finalString=finalString+"51.5 "; 
  } 
  if (t==52.00) { 
    finalString=finalString+"52 "; 
  } 
  if (t==52.50) { 
    finalString=finalString+"52.5 "; 
  } 
  if (t==53.00) { 
    finalString=finalString+"53 "; 
  } 
  if (t==53.50) { 
    finalString=finalString+"53.5 "; 
  } 
  if (t==54.00) { 
    finalString=finalString+"54 "; 
  } 
  if (t==54.50) { 
    finalString=finalString+"54.5 "; 
  } 
  if (t==55.00) { 
    finalString=finalString+"55 "; 
  } 
  if (t==55.50) { 
    finalString=finalString+"55.5 "; 
  } 
  if (t>=55.50) { 
    finalString=finalString+"HOT "; 
  } 
  finalString=finalString+"*C ";
}

void setup()
{
  Serial.begin(9600);

  // for DMD
  Timer1.initialize( 5000 );
  Timer1.attachInterrupt( ScanDMD );   
  dmd.clearScreen(true);
}

void loop()
{
  // get the temperature and round it to nearest 5
  t=@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
  t=round5(t);

  // now create the text to display on the DMD
  createTextTemp();

  // now send the text to the DMD
  drawText(finalString);
}


vrooms23
Posts:38
Joined:Sun Jun 30, 2013 9:23 am

Re: Need to find DMD with temp only

Post by vrooms23 » Wed Jul 24, 2013 11:53 am

I added include here:
#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 3
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

that done.
I figure out with start @@@@@@@@@@@@@@@@@@
I tried to code but got error:

void loop()
{
// get the temperature and round it to nearest 5
t=DallasTemperature.readTemperature();
t=round5(t);

// now create the text to display on the DMD
createTextTemp();

// now send the text to the DMD
drawText(finalString);
}

I not sure with t+...........

I checked other code temp use LCD, there nothing about t= with for DS18B20

User avatar
stryker
Posts:282
Joined:Sat Jan 14, 2012 2:44 pm

Re: Need to find DMD with temp only

Post by stryker » Wed Jul 24, 2013 12:52 pm

vrooms23 wrote: I figure out with start @@@@@@@@@@@@@@@@@@
I tried to code but got error:
Hi,

From what little code you've quoted here you certainly will get errors. The code provided for you above shows how to output the value read, but you're going to have to look for examples of how to use the DallasTemperature library to read the value from your oneWire sensor.

The documentation for that library is here. In the simple.pde example on that page he uses getTempCByIndex(), a function that returns a float...which is the type you need for the variable t, above. But you'll also need to include the rest of the logic from that sketch to retrieve the temperature from the sensor.

Cheers ! Geoff

vrooms23
Posts:38
Joined:Sun Jun 30, 2013 9:23 am

Re: Need to find DMD with temp only

Post by vrooms23 » Thu Jul 25, 2013 2:16 pm

All right, I'm still trying figure out so not work, and continue more learn,

I think leave code;

int round5(float n)
{
float a;
int b;
a = ((n/0.50)+0.5);
b = int (a);
b = b * 0.50;
return b;
}

can use for Dallas? possible change 0.1 each? I'm sorry I know must doing myself....

User avatar
stryker
Posts:282
Joined:Sat Jan 14, 2012 2:44 pm

Re: Need to find DMD with temp only

Post by stryker » Thu Jul 25, 2013 9:36 pm

If you want it to output in increments of 0.1 degrees that function can be modified to do that. What I'd suggest though is leave that modification until after you have the temperature reading in from the 1wire sensor and output at 0.5 degrees.

All the best,
Geoff

vrooms23
Posts:38
Joined:Sun Jun 30, 2013 9:23 am

Re: Need to find DMD with temp only

Post by vrooms23 » Sat Aug 03, 2013 2:02 pm

Got error, trying figure out so can't find the right

Code: Select all

void loop(void)
{
  // get the temperature and round it to nearest 5
  sensors.requestTemperatures();
  t=DallasTemperature.readTemperature(); 
  t=round5(t);

  // now create the text to display on the DMD
  createTextTemp();

  // now send the text to the DMD
  drawText(finalString);
}

angusgr
Freetronics Staff
Freetronics Staff
Posts:853
Joined:Tue Apr 09, 2013 11:19 pm
Location:Melbourne, Australia
Contact:

Re: Need to find DMD with temp only

Post by angusgr » Mon Aug 05, 2013 2:37 am

vrooms23 wrote:Got error
Can you post the exact error message that you get, please?

Post Reply