Show Posts
Pages: [1] 2
1  Development / Other Software Development / Re: new ways to manage Arduino libraries on: March 23, 2014, 01:15:28 pm
Hi there,

[snip]

Once you have found the libraries you need, You have to download it to your Arduino libraries folder, use it and probably forget it.

    This process cumbersome:
  • manual search with different possible options, not always well documented
  • manual download and install to Arduino libraries
  • no version control in the process (all versions of a library have the same name and thus cannot coexist in the Arduino library folder).

The tool I’m working on proposes a central repository for arduino libraries and an automated way of retrieving them, configuring them into your project and flashing the whole thing into the board.

Hi,
I was about to ask for something like this, but would like to know if something simpler could be arranged: allow users to add a suffix to library directory names so that versions and modifications can be identified. This would require Arduino to have some kind of compilation directive.

One specific case is the brilliant MIDI library. You're invited to change some things in a header file, and the only way I've found to indicate I've done that is to add a readme file with a suitable name. Also, the new version 4 has additional functionality. When I need that, I'd like to be able to rename the MIDI library something like MIDI_V4_AutoOff - the suffix indicates the version number followed by the setting of a directive.

I guess the difference with respect to professional programming is that we amateurs don't often use versioning tools.[/list]
2  Using Arduino / Audio / Re: Change MIDI channel on: January 24, 2014, 06:16:36 am
This thread may be cold by now - I havn't been lurking for a while.

You can do what you want using my midTemperament tuning aid application on http://www.music.chrblee.net/tuningaid/. Just ignore the features you don't need. If you want, you can set each octave of your keyboard to a different channel!

It uses a Sparkfun midi shield, though you can make your own, and the MIDI library with callbacks. My only Arduino is a Mega 2560, but a smaller one should be OK.

For the benefit of search engines, I mention that the application uses Roland JV / XP system exclusive messages (which are well handled by the library)  and allows you to microtune these synthesisers.
3  Using Arduino / Audio / Re: Build a Midi interface thanks to arduino on: January 24, 2014, 05:55:15 am
The easiest way is to buy a midi shield or breakout from Sparkfun. You may wish to connect it to a different serial port. Use the MIDI library; the new version works with soft serial, thou I havn't tried that (I use a mega, which has 4 hardwired ports). 

There are plenty of designs for making your own, but buying the composents could cost you more in the end if you don't have some already. Use a 6N136 optocoupler or equivalent. The ones given in the midi specifications tend to be too slow and unreliable, depending on the make and batch - this may explain the difficulties you read about on various forums.

As usual, the best way to write software is to adapt the examples and the numerous applications you can find on the web. Mine's on www.music.chrblee.net.
4  Using Arduino / Programming Questions / Re: mathematic libraries on: January 22, 2013, 04:13:33 pm
Discussions like this have been going on since at least 2010. Replies from the Arduino experts have been, to say the least, unsatisfactory, and the subject is well worth a rant. Arduino is for scientists as well.

In my own case I need to calculate small differences between high audio frequencies, which are in turn calculated from  values proportional to pitch (MIDI note numbers, cents). Similar situations arise in elementary statistics and, as several contributors have mentioned, several other areas where the Arduino is a perfectly appropriate platform. The key points are that evaluating the numerical stability of (for example) exponentiations is likely to be too difficult for most Arduinio users (including amateur and some professional scientists), as is interpolating between items in lookup tables. That's why spreadsheets such as Excel and Open Office Calc were suitably modified more than a decade ago so that ordinary users don't have to worry about numerical stability; 7-digit precision isn't even enough to calculate the mass of a fairly small molecule.

Since the early days of computing, and particularly during the period when home computers were 8-bit, it has been perfectly normal to write and use libraries of high-precision algorithms. Major scientific applications are still being written in old languages such as Fortran 77. C++ is supposed to be a major modern language, so there ought to exist a maths library that works with arbitrary levels of precision.

Arduinos such as the Mega have more than enough memory; several contributors have pointed out that computing time is not an issue here, and it's a pity that expert replies to this forum seem to be dominated by people who don't seem to understand that some of us need to combine real-time functionality with accurate calculations which are not time-critical.

So, I repeat the question that has been asked many times here: does there exist a multiple-precision C or C++ math library that could be used with Arduino?
5  Using Arduino / Installation & Troubleshooting / Re: Java zero-day security vulnerability on: January 14, 2013, 03:14:29 pm
I mean (I was approaching the subject gently), should we all stop using Arduino right now, on Windows systems or on all systems?
6  Using Arduino / Installation & Troubleshooting / Java zero-day security vulnerability on: January 14, 2013, 01:02:00 pm
Hello,

Should be be worried?
7  Using Arduino / Programming Questions / Re: serialEvent with yes/no dialogue? on: November 27, 2012, 03:58:46 am
@PaulS : then what I'm asking for would be an additional library.

For those of us new to this sort of thing, the logic behind serialEvent is hard to follow. As it's built in to Arduino, the user doesn't see whether or not 'void serialEvent()' is an interrupt handler that's called any time data arrives. Is the the following part of the comment before void serialEvent() in the example a little bit misleading?

'This routine is run between each time loop() runs,...

If it is an interrupt handler, should the reader just be advised to get back into loop() as frequently as necessary?  In my case they are typed in the terminal and can wait a few seconds for action.
8  Using Arduino / Programming Questions / serialEvent with yes/no dialogue? on: November 26, 2012, 04:40:18 pm
Hello,

serialEvent works perfectly as advertised. For the moment I use it with the Arduino terminal as I havn't started to link that to Processing.

Many times, you'd like your sketch to return an acopalyptic message requiring confirmation of a command. For example, if you type:

apocalypse <send>

Arduino could reply:

Delete Earth, Solar system, Galaxy, Universe; or Wait another day (E/S/G/U/W)?

It should be easy enough to program (presumably using static variables) but, since this is a commonly-required action, does anyone have a library that does the job in the professional manner?
9  Using Arduino / Audio / Re: Multiple MIDI I/Os on: November 23, 2012, 05:19:04 pm
Yes, I was going to ask a similar question.

I run a MIDI-shield through Serial1 of a mega, keeping Serial0 for normal use (snip the TX/RX pins and use jumpers to TX1/RX1). I'd like to have two MIDI-ins and was thinking of modifying a copy of the MIDI library so as to run more than one instance with piggy-backed shields or breakout boards.

It isn't so easy for someone of my level to know what to change in the library code, but if anyone could indicate what needs to be done (if it can be done) I could do the work. Obviously, a single multichannel version would be great.

Just one very little thing if Franky47 is still working on it: most MIDI devices send Note Off as a Note On with zero velocity (it's in the standard). At present you have to catch that in your Note On handler; easy, but it would be nice to have it built in to the library. It's always OK to send a proper MIDI off.

10  Using Arduino / Audio / Re: is there other software for midi controller but not ableton or garageband? on: October 30, 2012, 03:31:43 pm
Just a little warning about HANKENSTEIN's post: unless you unclick all the boxes, the LMMS download package will also install one of those horrible crapware things that pollute your computer for ever and a day. I'm fed up with helping friends decontaminate their machines. There must exist less asocial ways of financing software projects.
11  Using Arduino / Programming Questions / Re: Comparing Strings with serialEvent on: October 30, 2012, 10:37:28 am
Many thanks PaulS. I suppose you could change the order of commands in void serialEvent() so the newline doesn't get appended to inputString, but presume the author had reasons for not doing that. A bit of browsing turns up method trim() which does the job nicely. Here's my corrected and tested version, with "chris" declared as though it were a constant:

 
Code:
/*
  Serial Event example, with addition by crlMIDI
 
 When new serial data arrives, this sketch adds it to a String.
 When a newline is received, the loop prints the string and
 clears it.
 
 A good test for this is to try it with a GPS receiver
 that sends out NMEA 0183 sentences.
 
 Created 9 May 2011
 by Tom Igoe
 
 This example code is in the public domain.
 
 http://www.arduino.cc/en/Tutorial/SerialEvent
 
 */

String inputString = "";         // a string to hold incoming data
boolean stringComplete = false;  // whether the string is complete
// the string we are going to compare inputString with
String myString1 = "chris";

void  setup() {
  // initialize serial:
  Serial.begin(9600);
  // reserve 200 bytes for the inputString:
  inputString.reserve(200);
}

void loop() {
  // print the string when a newline arrives:
  if (stringComplete) {
    checkMystring();
    Serial.println(inputString);
    // clear the string:
    inputString = "";
    stringComplete = false;
  }
}
 
  void checkMystring() {
    // trim is a method of the String class that removes whitespace
    // including Newline and Carrriage return
    inputString.trim();
    // either of the following 2 commands is OK:
     if (inputString == myString1)
    // if (inputString.equalsIgnoreCase(myString1))
      {Serial.println("Matches"); }
    else {Serial.println("Match not found"); } 
}

/*
  SerialEvent occurs whenever a new data comes in the
 hardware serial RX.  This routine is run between each
 time loop() runs, so using delay inside loop can delay
 response.  Multiple bytes of data may be available.
 */
void serialEvent() {
  while (Serial.available()) {
    // get the new byte:
    char inChar = (char)Serial.read();
    // add it to the inputString:
    inputString += inChar;
    // if the incoming character is a newline, set a flag
    // so the main loop can do something about it:
    if (inChar == '\n') {
      stringComplete = true;
    }
  }
}

12  Using Arduino / Programming Questions / Comparing Strings with serialEvent on: October 29, 2012, 04:59:47 pm
Hello,
I must be doing something stupid with my Mega2560 (Arduino 1.0.1) when trying to test a String that's input using the serialEvent example with my own strings. In the example below, checkMystring() always returns 'String not found'. I've tried all sorts of variations. Perhaps I can't get my head round the object/variable/constant uncertainty that seems to surround the Arduino String object, at least in the minds of newbies.

Quote
/*
  Serial Event example
 
 When new serial data arrives, this sketch adds it to a String.
 When a newline is received, the loop prints the string and 
 clears it.
 
 A good test for this is to try it with a GPS receiver 
 that sends out NMEA 0183 sentences. 
 
 Created 9 May 2011
 by Tom Igoe
 
 This example code is in the public domain.
 
 http://www.arduino.cc/en/Tutorial/SerialEvent
 
 */

String inputString = "";         // a string to hold incoming data
boolean stringComplete = false// whether the string is complete
// Can't get these commented-out ones to work:
//String myString = String("chris");
//String myString = "chris";
String myString1;

void  setup() {
  // initialize serial:
  Serial.begin(9600);
  // reserve 200 bytes for the inputString:
  inputString.reserve(200);
  myString1 = String("chris");
}

void loop() {
  // print the string when a newline arrives:
  if (stringComplete) {
    checkMystring();
    Serial.println(inputString);
    // clear the string:
    inputString = "";
    stringComplete = false;
  } 
}
  
  void checkMystring() {
    // if (inputString == myString1)  .. doesn't work either
    if (inputString.equalsIgnoreCase(myString1))
      {Serial.println("Matches"); }
    else {Serial.println("Match not found"); } 
}

/*
  SerialEvent occurs whenever a new data comes in the
 hardware serial RX.  This routine is run between each
 time loop() runs, so using delay inside loop can delay
 response.  Multiple bytes of data may be available.
 */
void serialEvent() {
  while (Serial.available()) {
    // get the new byte:
    char inChar = (char)Serial.read();
    // add it to the inputString:
    inputString += inChar;
    // if the incoming character is a newline, set a flag
    // so the main loop can do something about it:
    if (inChar == '\n') {
      stringComplete = true;
    } 
  }
}


13  Using Arduino / Audio / Re: Help for MIDI Library v3.2 on: September 28, 2012, 01:46:42 pm
Hello,

I came across this thread while looking for something else.

It prompted me to post - very much prematurely - a sketch that does Roland sysex: http://www.music.chrblee.net/tuningaid/index.html. Since I did that I discovered how to attach files to a post on this forum. The code is definitely not for the eyes of Inspector TidyCode, but it works. Well, it started working this afternoon.

One thing I forgot to mention is that if you send a sysex Data Request to a Roland JV, the response lacks the final F7. This might be troublesome if you locate the data you want by its distance from the end of the array. Perhaps I should configure the brilliant MIDI.h, as proposed, to insert the F0 and F7 automatically.

Another thing, if you send a Data Set sysex, make sure you put in a delay (Roland says 20ms, a source on the web says 40). The JV responds with some junk, perhaps to make sure you remember this.

Finally, the best way to use a MIDI shield with a Mega is to snip off the two serial (0) pins, and connect the shield to serial1. You need serial0 to see what your code is getting up to...
14  Using Arduino / Programming Questions / Re: Equality operators don't work in "for" loops on: July 16, 2012, 09:04:52 am
Point taken, except that I use Arduino & don't consider myself a complete idiot.

When using structures that have been in common use in other languages for several decades it should normally be sufficient to look up just the syntax. The documentation and the Arduino Cookbook (700 pages)  are very well written; all I was saying is that it would help if the little warnings about the differences between Arduino and pure C++ could be extended to include other languages a user is likely to have encountered.

If you've had the misfortune to write XL VBA macros during the day for your employer, a little reminder that C++ "for" loops don't have the equivalent to "to" in them would make life easier when you switch to Arduino and a different reference book back at home.
15  Using Arduino / Programming Questions / Re: Equality operators don't work in "for" loops on: July 16, 2012, 08:21:09 am
Thanks,

It does need documenting more explicitly for Arduino users, then, because this seems to be one of those  C++ wierd things that we aren't all familiar with.

Normally, you'd expect the middle bit of "for" loops to mean "until". Various dialects of Pascal and BASIC have separate "for - until" and "while" constructs.

Regards
Pages: [1] 2