Show Posts
Pages: 1 ... 29 30 [31] 32 33 ... 85
451  Using Arduino / Audio / Re: play & sync a midi file to external clock on: August 31, 2013, 07:19:44 pm
In principle it could work. I am guessing that if you just play when you get the event it will not work.

I would start by getting a copy of the MIDI standard and reading up on the messages you expect to process.  Then capture what is coming down the line and check that it is as you expect. The code is then easy.  The whole thing is straightforward but you need to get you head around it.
452  Using Arduino / Audio / Re: play & sync a midi file to external clock on: August 31, 2013, 05:57:20 pm
If you are trying to open the file 28.mid, then the code you gave looks like it should do it. Does it work? You could try printing out the file name using Serial.print (if the serial port is available) or using an LCD to display the data if you need confirmation.

Note however, that
Code:
  int err;
  if (err != -1)
is not likely to work as err has not been set by anything.

As I understand it, the MIDI beat clock is a clock signal that is broadcast via MIDI to ensure that several MIDI-enabled devices such as a synthesizer or music sequencer stay in synch, controlled from a central place. This is different from a MIDI time code, which is actually providing timing in frames/second (eg, for film based timing). This makes the MIDI beat clock tempo-dependent. Clock events are sent at a rate of 24 pulses per quarter note (ppqn), with no additional information, like bar number or time code, and so must be used in conjunction with a positional reference (such as timecode or a synchronised start) for complete sync.

The MIDIFILE library reads the time signature of the MIDI file and converts the ppqn signature (usually in track 0) into 'milliseconds between events'. It then essentially implements the technique of checking millis() against the previous time value to determine when events needs to be fired off. This keeps all the tracks in synch but the actual timing could be slightly off compared to external 'real' time. It should be possible to change the way the library handles time so that it is synchronised to an external clock rather than using its internal timing. From memory, most of that code sits in the MIDIFile object code.
453  Using Arduino / LEDs and Multiplexing / Re: MAX72XX Sketches, don't compile.. on: August 31, 2013, 03:05:36 pm
Quote
But thanks to every one I now have them working, but getting both working together?? Sure one of the sketches does that.

In the MAX72xx examples, there is usually a NUMDEVICES define that tells the system how many matrices are joined up. Change that and make sure that the two matrices are joined together properly and you should see something.

Good luck.
454  Using Arduino / Displays / Re: LCD menu flicker on: August 31, 2013, 07:04:49 am
The flashing is caused by your call to clear the display. This happens when you start the update, which is also when the serial message is sent, hence the synchronization. If you clear a lot you will get a continuous lcd flicker. Now it should be flickering once a second (ie a lot less). If you want to completely stop the flickering you need to comment out the clear. As suggested earlier, this will mean you have to be careful how the message is pinted to make sure it overwrites the previous one completely.

I am assuming that the messages are once per second and the flicker is too. Can you confirm?
455  Using Arduino / Displays / Re: LCD menu flicker on: August 31, 2013, 05:52:08 am
So here's one issue: the print is inserted before the opening brace. This makes the if statement only execute the print and then do the rest of the code as before. You need to move the print to after the opening brace so that it is part of the block of code controlled by the if statement
Code:
if ....
{
  Serial.println statement
  Etc
456  Using Arduino / Displays / Re: LCD menu flicker on: August 31, 2013, 05:17:31 am
Can you repost all the code with the current changes. Something is not right.
457  Using Arduino / Displays / Re: LCD menu flicker on: August 31, 2013, 03:55:09 am
I would put it after the start of the if statement so that you catch when the event happens, not just when you read the time. Also make it a println and you need to put a message between parentheses- Serial.println( "Time change"), or similar.
458  Using Arduino / Displays / Re: LCD menu flicker on: August 31, 2013, 02:15:27 am
Serial.begin in setup() with the baud rate.
Serial.print or Serial.println when you want to print.
459  Using Arduino / Displays / Re: LCD menu flicker on: August 31, 2013, 02:09:41 am
Yes that is the spot I think it goes in.

You should try putting some serial print statements to tell you when the LCD is updated. This should have changed it to once a second, so there should be no flicker at all.  One spot to print from is at the start of the if statement we just put in. It should only print once per second. Any faster and something is not right.
460  Using Arduino / Displays / Re: LCD menu flicker on: August 31, 2013, 01:30:46 am
I make the closing bracket needed just before the check for the menu button. Looks like you put it later. The last brace in my original post is where I think it should be.
461  Using Arduino / Displays / Re: LCD menu flicker on: August 31, 2013, 01:08:18 am
Yes but you will need a matching close bracket to close off the 'if' statement near the end, as in my example, after the last LCD.print for the time message, so the rest of the code for time printing is unchanged but bracketed by the if.
462  Using Arduino / Displays / Re: LCD menu flicker on: August 31, 2013, 12:15:34 am
Ok.

I think this is the change you need in loop(), but I have not tested it smiley-wink
Code:
  static byte lastSecond = 0;  // <-- remembers the last seconds value (static persists)
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;

  getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);

  if (second != lastSecond)  // <-- only does the time stuff if the time has changed
  {
    lastSecond = second;  // <-- save this for next time
    lcd.clear(); // clear LCD screen
    lcd.setCursor(0,0);
//... etc, code is unchanged
    lcd.print("Off");
    }
  }
463  Using Arduino / Displays / Re: LCD menu flicker on: August 30, 2013, 11:41:16 pm
Looks to me like the time is written every time through the loop. The first thing the code does is clear the display, which will make it flicker as you are doing this hundreds of times a second.

Couple of ways to address this:
1. Only update the screen when the time has changed. Practically you just need to remember the seconds value and when that is different from the previous time you update the LCD.
2. Turn off screen updates while you are putting things on the LCD and then turn them on after you have update. This should make it smoother.

My preference for the first as you can avoid anything to do with the screen formatting, etc, if the time is unchanged - that means you have more clock cycles for something useful.
464  Using Arduino / LEDs and Multiplexing / Re: MAX72XX Sketches, don't compile.. on: August 30, 2013, 11:33:19 pm
The landing page for the libraries at the code repository tells you how to install the library
Quote
For the Arduino IDE to be able to find and use them, these libraries should be uncompressed and placed in a libraries subfolder of your sketchbook folder.
1.Download the compressed (zip) file from the Downloads section (above).
2.Find or create the libraries subfolder of your Arduino sketchbook folder.
3.Uncompress the zip file in the libraries folder, keeping each library in its own unique folder.
465  Using Arduino / LEDs and Multiplexing / Re: MAX72XX Sketches, don't compile.. on: August 30, 2013, 08:18:18 pm
The max72xx library should work with your cheap Chinese type matrix units. It would help me if you can say what the exact error message is? IDE version would also be helpful, as the libraries will only work for v1 onwards.

On the surface it sounds like the libraries are not properly installed.
Pages: 1 ... 29 30 [31] 32 33 ... 85