Show Posts
Pages: 1 ... 20 21 [22] 23 24 ... 86
316  Using Arduino / LEDs and Multiplexing / Re: flashing multiple LEDs at different rates on: January 03, 2014, 01:31:20 pm
In my code repository (see link below) there is a sketch called multiblink that does what you seem to need.
317  Using Arduino / LEDs and Multiplexing / Re: display time on MAX7219 base matrix display ??? on: January 02, 2014, 03:32:55 pm
1. Check (by printing) that the message is what you think it is.
2. Set the animation to just scrolling and see if the message appears.

You are either cutting off the message in the buffer or you are not displaying the whole thing. No other possibilities that I can see.
318  Using Arduino / LEDs and Multiplexing / Re: display time on MAX7219 base matrix display ??? on: January 02, 2014, 02:43:31 pm
The software can scroll the message onto the screen so someone looking can read it. If that is not good enough then get a bigger matrix or make shorter messages.
319  Using Arduino / Programming Questions / Re: Lcd menu, help needed on: December 31, 2013, 04:07:25 pm
MenWiz has the ability to display a user screen, and the menu will invoke a function in your code when the menu times out.

What you need to do is format the string you want to display (with the 'live' data) and then call the menWiz function to display it for you. I think (from memory) that the menwiz example uses this to display the millis() (this is live) and the free memory (which is live but does not change much).

If your question is how to change the data screens, this code may help.

Code:
void myDisplay(void)
// Callback from the menu system to display my own screen data
{
  static uint8_t state = 0;
  static  char buf[7];
  static uint32_t tmStart = 0;

  // switch user screens once every period
  if (millis() - tmStart >= 3000)
  {
    state++;
    tmStart = millis();
  }

  switch (state)
  {
  case 0:
    // line 1
    strcpy(menu.sBuf,"Uptime : ");
    strcat(menu.sBuf, itoa((int)(millis()/1000), buf, 10));
    // line 2
    strcat(menu.sBuf,"\nFreeRAM: ");
    strcat(menu.sBuf, itoa((int)menu.freeRAM(), buf, 10));
    break;

  case 1:
    // line 1
    strcpy(menu.sBuf,"Int8 : ");
    strcat(menu.sBuf, itoa(varInt8, buf, 10));
    // line 2
    strcat(menu.sBuf,"\nInt16: ");
    strcat(menu.sBuf, itoa(varInt16, buf, 10));
break;

  case 2:
    // line 1
    strcpy(menu.sBuf,"Bool : ");
    strcat(menu.sBuf, varBool ? "YES" : "NO");
    // line 2
#if USE_FLOAT
    strcat(menu.sBuf,"\nFloat: ");
    strcat(menu.sBuf, dtostrf(varFloat, 0, FLOAT_DEC, buf));
#else
    strcat(menu.sBuf,"\n");
#endif
    break;

  case 3:
    // line 1
    strcpy(menu.sBuf,"Short List: ");
    strcat(menu.sBuf, itoa(varShortList, buf, 10));
    // line 2
    strcat(menu.sBuf,"\nLong  List: ");
    strcat(menu.sBuf, itoa(varLongList, buf, 10));
break;

  default:
    state = 0;
    return; // don't update the screen
  }

  menu.drawUserScreen(menu.sBuf);
}
320  Using Arduino / LEDs and Multiplexing / Re: display time on MAX7219 base matrix display ??? on: December 30, 2013, 06:54:34 pm
When you do that you will need to change the strings from constants to character arrays, like for the datetime.

Good luck.
321  Using Arduino / LEDs and Multiplexing / Re: display time on MAX7219 base matrix display ??? on: December 30, 2013, 05:02:36 pm
Same caveats as before.

Code:
//
// Display text on the matrix followed by the time and the cycle repeats.
//

#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <Wire.h>
#include <Rtc_Pcf8563.h>

//init the real time clock
Rtc_Pcf8563 rtc;

// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may
// need to be adapted
#define MAX_DEVICES 6
#define CLK_PIN 13
#define DATA_PIN 11
#define CS_PIN 10

// set to 1 if we are implementing the user interface pot
#define USE_UI_CONTROL 0

#if USE_UI_CONTROL
#define SPEED_IN A0
#endif // USE_UI_CONTROL

#define PAUSE_TIME 1000
#define SPEED_DEADBAND 5
uint8_t frameDelay = 25; // default frame delay value

MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

#define SPEED_TIME 10
#define PAUSE_TIME 1000

// Global variables
uint8_t  curText;
char  szDateTime[20];
char *pc[] =
{
  "This is",
  "Just a",
  "Test",
  szDateTime,
};

uint8_t  inFX, outFX;
MD_Parola::textEffect_t effect[] =
{
  MD_Parola::PRINT,
  MD_Parola::SCROLL_LEFT,
  MD_Parola::WIPE,
  MD_Parola::SCROLL_UP,
  MD_Parola::OPENING_CURSOR,
  MD_Parola::BLINDS,
  MD_Parola::CLOSING,
  MD_Parola::WIPE_CURSOR,
  MD_Parola::DISSOLVE,
  MD_Parola::OPENING,
  MD_Parola::CLOSING_CURSOR,
  MD_Parola::SCROLL_RIGHT,
  MD_Parola::SCROLL_DOWN,
  MD_Parola::SLICE,
};


void setup(void)
{
  Serial.begin(57600);
 
  //clear out the registers
  //rtc.initClock();
  //set a time to start with.
 
  //day, weekday, month, century(1=1900, 0=2000), year(0-99)
  // uncomment to set
  //rtc.setDate(30, 1, 12, 0, 13);
 
  //hr, min, sec
  //uncomment to set
  //rtc.setTime(18, 42, 0);

  P.begin();
  P.setInvert(false);
  P.displayText(pc[curText], MD_Parola::CENTER, SPEED_TIME, PAUSE_TIME, effect[inFX], effect[outFX]);
}

void loop(void)
{
  if (P.displayAnimate()) // animates and returns true when an animation is completed
  {
    strcpy(szDateTime, rtc.formatTime());
   
    // Set the display for the next string.
    curText = (++curText) % ARRAY_SIZE(pc);
    P.setTextBuffer(pc[curText]);

    // When we have gone back to the first string, set a new exit effect
    // and when we have done all those set a new entry effect.
    if (curText == 0)
    {
      outFX = (++outFX) % ARRAY_SIZE(effect);
      if (outFX == 0)
  {
        inFX = (++inFX) % ARRAY_SIZE(effect);
if (inFX == 0)
P.setInvert(!P.getInvert());
  }
       
      P.setTextEffect(effect[inFX], effect[outFX]);
    }

    // Tell Parola we have a new animation
    P.displayReset();
  }
}

322  Using Arduino / LEDs and Multiplexing / Re: display time on MAX7219 base matrix display ??? on: December 30, 2013, 04:00:54 pm
Sure there is. What exactly are you trying to achieve?
323  Using Arduino / LEDs and Multiplexing / Re: display time on MAX7219 base matrix display ??? on: December 30, 2013, 03:13:47 pm
I don't have your RTC library and have not compiled tested this code, but it should display whatever was in the serial printout.

Code:
//
// Display current date and time using Parola library
//

#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <Wire.h>
#include <Rtc_Pcf8563.h>

//init the real time clock
Rtc_Pcf8563 rtc;

// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may
// need to be adapted
#define MAX_DEVICES 6
#define CLK_PIN 13
#define DATA_PIN 11
#define CS_PIN 10

// set to 1 if we are implementing the user interface pot
#define USE_UI_CONTROL 0

#if USE_UI_CONTROL
#define SPEED_IN A0
#endif // USE_UI_CONTROL

#define PAUSE_TIME 1000
#define SPEED_DEADBAND 5
uint8_t frameDelay = 25; // default frame delay value


MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

#define SPEED_TIME 10
#define PAUSE_TIME 1000

// Global variables
char szDateTime[20] = {""};

uint8_t  inFX, outFX;
MD_Parola::textEffect_t effect[] =
{
  MD_Parola::PRINT,
  MD_Parola::SCROLL_LEFT,
  MD_Parola::WIPE,
  MD_Parola::SCROLL_UP,
  MD_Parola::OPENING_CURSOR,
  MD_Parola::BLINDS,
  MD_Parola::CLOSING,
  MD_Parola::WIPE_CURSOR,
  MD_Parola::DISSOLVE,
  MD_Parola::OPENING,
  MD_Parola::CLOSING_CURSOR,
  MD_Parola::SCROLL_RIGHT,
  MD_Parola::SCROLL_DOWN,
  MD_Parola::SLICE,
};


void setup(void)
{
  Serial.begin(57600);
 
  //clear out the registers
  //rtc.initClock();
  //set a time to start with.
 
  //day, weekday, month, century(1=1900, 0=2000), year(0-99)
  // uncomment to set
  //rtc.setDate(30, 1, 12, 0, 13);
 
  //hr, min, sec
  //uncomment to set
  //rtc.setTime(18, 42, 0);

  P.begin();
  P.setInvert(false);
  P.displayText(szDateTime, MD_Parola::CENTER, SPEED_TIME, PAUSE_TIME, effect[inFX], effect[outFX]);
}

void loop(void)
{
  if (P.displayAnimate()) // animates and returns true when an animation is completed
  {
  strcpy(szDateTime, rtc.formatTime());
   P.setTextBuffer(szDateTime);

    outFX = (++outFX) % ARRAY_SIZE(effect);
    if (outFX == 0)
    {
      inFX = (++inFX) % ARRAY_SIZE(effect);
      if (inFX == 0)
P.setInvert(!P.getInvert());
    }
       
    P.setTextEffect(effect[inFX], effect[outFX]);

    // Tell Parola we have a new animation
    P.displayReset();
  }
}

324  Using Arduino / Programming Questions / Re: 'Corrupt' LCD special characters on: December 30, 2013, 03:01:40 pm
I had a similar issue and fixed it by turning LCD updates off while I loaded the characters or refreshed the data for the display and then turned it back on. Not sure why (speed or timing?) but it has worked reliably since.
325  Using Arduino / LEDs and Multiplexing / Re: display time on MAX7219 base matrix display ??? on: December 30, 2013, 02:46:04 pm
The code you have there is from the demo to show the different text effects, so you will get a whole lot of different in and out text. I am assuming that you managed to get the display of the test message working ok?

This only just displays the date & time to the serial monitor (why didn't you use Serial.println(), by the way?)
Code:
    Serial.print(rtc.formatTime());
You actually need to strcpy() the date and time to a character buffer (array of characters) and then pass that to the Parola library for display, instead of the test message. The rest should work ok.

You may want to consider showing the date on one pass of the display and the time on the next display (like the test code shows the sentence split up).
326  Using Arduino / Programming Questions / Re: MENWIZ Question on: December 27, 2013, 01:53:31 pm
The PASS messages are left over debugging code in the MENWIZ library.

Get rid of them by deleting those lines in the library code.
327  Using Arduino / Audio / Re: LDR with logic pro 9 (midi trigger) on: December 22, 2013, 12:41:06 am
Add more by doing the same thing on a different analog port.
328  Using Arduino / LEDs and Multiplexing / Re: New around with a strange problem(8x8 matrix) on: December 18, 2013, 08:46:23 pm
If you are using cheaper 'clone' chips for the MAX7219 then we have found this behaviour is common. See this thread http://forum.arduino.cc/index.php?topic=171056.0 and how we solve the problem (not ideal).
329  Using Arduino / Sensors / Re: Color Sensor TCS230 on: December 18, 2013, 08:41:14 pm
Quote
Well your result is only going to be limited to 255,  if it is a one-byte unsigned number.

To the letter this is true. However, the sensor library is supposed to return an RGB value. If the library is not doing that there is a problem with the library, as a correct RGB reading is always 0-255. The RGB value is derived from the frequency returned and there is a linear relationship between the two, so you see scaling factors built into the code OP is using.
330  Using Arduino / Programming Questions / Re: do libraries save space ? on: December 18, 2013, 12:06:41 am
They may or may not save space, but they certainly save time and get your projects up and running faster.

As long as the person who wrote the library knew what he/she was doing ...
Pages: 1 ... 20 21 [22] 23 24 ... 86