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]
User avatar
stryker
Posts:282
Joined:Sat Jan 14, 2012 2:44 pm
Re: Need to find DMD with temp only

Post by stryker » Sat Aug 10, 2013 9:42 am

The output from the debugging serial prints shows the sensor reading is working fine. Your issue is with the code that converts the value to a string, likely in createTextTemp() therefore.

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

Re: Need to find DMD with temp only

Post by vrooms23 » Mon Sep 09, 2013 2:53 pm

stryker wrote:The output from the debugging serial prints shows the sensor reading is working fine. Your issue is with the code that converts the value to a string, likely in createTextTemp() therefore.
Yeah, something with createTextTemp() that problem, no idea, haven't solved problem for ages, I will try fix with this.

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

Re: Need to find DMD with temp only

Post by vrooms23 » Fri Sep 13, 2013 2:39 pm

I have tested with code who created, but huge problem! I checked read temp without createTextTemp(); read temp is fine by Serial Monitor. And removed all like;

Code: Select all

if (t==-8.50) {
finalString=finalString+"-8.5 "; 
}
I made short code for test only;

Code: Select all

void createTextTemp(){
  finalString=" "; // wipe the sentence out for special cases (below)
  finalString=finalString+"It's ";
 finalString=finalString+"-10 "; 
  finalString=finalString+"*C ";
}

Its fine run show display, something is reason with all;

Code: Select all

 if (t==xx.xx) { 
 finalString=finalString;+"xx.x "; 
 } 
guess someone have never had test with code. I'm trying work out.

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

Re: Need to find DMD with temp only

Post by vrooms23 » Fri Sep 13, 2013 3:42 pm

Who created a code temp but date was last April or more past which used Arduino version is 1.0.4 by March 11th 2013, but now 1.0.5 by May 15th 2013, and might not work with this code I have tried so nothing, maybe 1.0.5 not work for this code, anyone have try with code use 1.0.5?

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

Re: Need to find DMD with temp only

Post by stryker » Sat Sep 14, 2013 6:42 am

Show us what you see in the Serial monitor.

There is no problem with compatibility with sketches of that age and IDE v1.05

Cheers ! Geoff

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

Re: Need to find DMD with temp only

Post by vrooms23 » Sat Sep 14, 2013 2:28 pm

stryker wrote:Show us what you see in the Serial monitor.

There is no problem with compatibility with sketches of that age and IDE v1.05

Cheers ! Geoff
Serial Monitor showed;

DHT output: 22.40 After rounding: 22.00 finalString:
DHT output: 22.40 After rounding: 22.00 finalString:
DHT output: 22.30 After rounding: 22.00 finalString:
DHT output: 22.30 After rounding: 22.00 finalString:

but I removed createTextTemp();, if leave void so nothing show as error, its weird, no idea what reason with this code.

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

Re: Need to find DMD with temp only

Post by stryker » Sun Sep 15, 2013 2:20 am

Hi

That's good. Now can you please post all your code again, and the error you're seeing?

You can't just remove a function without it causing an error if it's still being called within your code of course. In this case if that function has an error in it, the fix will be to correct the function rather than remove it entirely.

Post you're code and error and let's see where you're coming unstuck now.

Cheers ! Geoff

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

Re: Need to find DMD with temp only

Post by vrooms23 » Mon Sep 16, 2013 11:21 am

Code: Select all

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);
}
That code designed from John Boxall, but code is fine and no error, only display nothing show run temp, I tested myself for run the display demo only,

Code: Select all

void createTextTemp(){
  finalString=" "; // wipe the sentence out for special cases (below)
  finalString=finalString+"It's ";
 finalString=finalString+"-10 "; 
  finalString=finalString+"*C ";
}
That display is work fine, show "Its's 20.5 *C", I removed createTextTemp(); and check Serial Monitor read to temp are fine, but leave createTextTemp(); run so nothing show on Serial Monitor and some error cut not full, weird no work through like this;

Code: Select all

if (t==xx.xx) { 
    finalString=finalString+"xx.x ";

Post Reply