Show Posts
Pages: 1 2 [3] 4 5 ... 18
31  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Serial.begin Doc -- minor issue on: August 18, 2009, 08:34:33 am
fixed, thanks rappa.

32  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Several problems with large byte arrays on: July 28, 2009, 11:17:57 pm
Make sure you use the PROGMEM datatypes when you use PROGMEM. I remember my sketches generated bizarre bugs with corrpt data at certain size limits when I used regular data types.

The PROGMEM docs continue to suffer banishment from management, so you have to dig for them.
33  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Timer Docs Anyone? on: July 31, 2009, 08:03:56 pm
Thanks David,

Very useful. In my ideal world I think a lot of this material would be in a more accessible place.

I propose starting to add sections on the reference page that are "below the fold". This is, after the footer (don't know if the footer would let use do that but the footer boilderplate could be some kind of shtml include instead. Maybe a heavy rule could be added to reinforce where the "standard" docs are ending.

Material "below the fold" could include geeky details like are listed on the resources page, how long the function takes to execute, other geeky caveats about which functions the function is likely to interfere with etc. Plus some advanced examples. Users would never need to see the material unless they wanted to scroll down. And beginning students could be instructed to generally ignore the extra notes.

There have been several other requests on this forum topic for that kind of detailed information, that has been heretofore unavailable, unless one really wanted to dig through the source code.
34  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Timer Docs Anyone? on: July 30, 2009, 01:41:12 pm
Thanks macegr - this  is great piece. I'll see if the author minds if we reformat for the Arduino docs wiki. Not much I saw on the Arduino source code but I just scanned it. I'm sure writing it up will get me most of the way there.

Arudino forums are amazing.

35  Forum 2005-2010 (read only) / Bugs & Suggestions / Timer Docs Anyone? on: July 28, 2009, 11:44:15 pm
It is my belief that the Arduino language really needs some docs on how the timers work: what functions use what timers? what will break when a timer is repurposed etc.

I don't really feel competent to do this, but many people have written libraries based on the timers. There are so many things that can ONLY be done by using timers and AVR code, that I feel it's time to give users a place to begin using these valuable tools, and also a way into really understanding the source code. Plus I want to know for selfish reasons, so I can understand the source code, and begin playing with timers and interrupts myself.

If anyone would like to take a shot at writing some docs / and or a tutorial on timers vis a vis Arduino , I will try and compile and edit it and get it in the docs somewhere, and help to extend it and maintain it.

Where the docs go when they are written remains another issue, but we'll find a place.

36  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Parenthesis checking and commented out code on: June 30, 2009, 07:15:16 am
Long-standing bug. Due for fix in 2012.

37  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Error: Example code for Analog Sensor Calibration on: June 30, 2009, 07:11:02 am
Thanks Endante,

Fixed the learning page. The actual code for the calibration example may still be broken though.

38  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: autoformat bug with syntactical error in for loop on: June 14, 2009, 07:02:37 pm
The autoformat function is still pretty buggy and is best avoided until after you have made sure that the program compiles.

It used to have a charming "auto-delete" bug where code was deleted if brackets weren't balanced (which balanced the code) but that one has been fixed for a while. There are still many bugs and quirks in it though so compile first - and you'll be happier.
39  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Define function documentation in stealth mode.. on: June 14, 2009, 06:42:01 pm
This reference was part of the official Arduino documentation, on the language page, for about year, until Arduino management decided that it shouldn't be part of the language page documentation anymore.

I believe it was banished to the Foundations page, which is something of backwater off the Learning page. The management and I had an extended disagreement about including a top level link to the Foundations page off the reference page, with the result being that the top level link would be redundant and could not be included at the top of the reference page.

Of course there are many resources for learning C, but it happens that lots of students start working with the Arduino without having coded in C before. So I believe that more of this support material is justified.

I believe it is also easier for students to see examples in the environment in which they are coding. Others however apparently disagree.


40  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: floating point remark in the reference still true? on: May 12, 2009, 11:44:36 pm
Deleted, since we can print floats since v 014? In the next release we may even be able to set the precision of floating point numbers that we print.

See you don't know even know how good you got it. When I was a kid we had to get up and walk across the room to change the TV channel...
41  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Communication Examples Broken in Processing on: May 04, 2009, 09:41:55 am
I see that the code has been changed on example page.
I'll try them out.

In the code below though (from virtual color mixer), what calls SerialEvent?

import processing.serial.*;

float redValue = 0;        // red value
float greenValue = 0;      // green value
float blueValue = 0;       // blue value

Serial myPort;

void setup() {
  size(200, 200);

  // List all the available serial ports
  // I know that the first port in the serial list on my mac
  // is always my  Arduino, so I open Serial.list()[0].
  // Open whatever port is the one you're using.
  myPort = new Serial(this, Serial.list()[0], 9600);
  // don't generate a serialEvent() unless you get a newline character:

void draw() {
  // set the background color with the color values:
  background(redValue, greenValue, blueValue);

void serialEvent(Serial myPort) {
  // get the ASCII string:
  String inString = myPort.readStringUntil('\n');

  if (inString != null) {
    // trim off any whitespace:
    inString = trim(inString);
    // split the string on the commas and convert the
    // resulting substrings into an integer array:
    float[] colors = float(split(inString, ","));
    // if the array has at least three elements, you know
    // you got the whole thing.  Put the numbers in the
    // color variables:
    if (colors.length >=3) {
      // map them to the range 0-255:
      redValue = map(colors[0], 0, 1023, 0, 255);
      greenValue = map(colors[1], 0, 1023, 0, 255);
      blueValue = map(colors[2], 0, 1023, 0, 255);

42  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Communication Examples Broken in Processing on: May 03, 2009, 02:49:08 pm
Yes they're from 15. Tom may not have tested, or he may have just been lucky. Or processing may have changed a function a bit since he tested. I think I wrote the "hacking a Processing sketch" tutorial last year - I guess there's a date on change log, and the code worked fine then.

The bug only  happens on first call to Serial.available (in processing) so could be a number of things that changed I imagine. As I said in my post, it can happen at any time the buffer has NewLine char but no other data.

BTW - it might not be that idea to have more error checking in the routines - but commented out. If there is a noisy serial line (e.g. radios) and a non-numeric char gets through - ParseInts gags.

Please post links to ParseInts source if you know it. The Processing guys apparently like to keep some things secret too.

43  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Communication Examples Broken in Processing on: May 01, 2009, 07:00:37 am
If the first character that the serialEvent sees is a NEWLINE - with nothing else in the buffer, then the function will fail at the buff trim. If the only two characters in the buffer are NEWLINE, CR, then the function fails at ParseInt. (BTW - you really have to dig on the processing site for any info on parseInt method - I still can't find code for it.)

The lack of characters in the buffer seems to happen almost every time on the first function call to Serial.available, so I think there is something in the Processing functions that favors it. A little defensive programming isn't a bad thing though.

Here's one fix

void serialEvent(int serial)
  if (serial != NEWLINE) {
    // Store all the characters on the line.
    buff += char(serial);
  } else {
    // The end of each line is marked by two characters, a carriage
    // return and a newline.  We're here because we've gotten a newline,
    // but we still need to strip off the carriage return.

// this is the fix - not in original code
 if (buff.length < 2){
buff = "";             // clear out the buffer
port.clear             // clear out serial buffer
return;                   // return to avoid parseInt
// end fix

    buff = buff.substring(0, buff.length()-1);
    // Parse the String into an integer.  We divide by 4 because
    // analog inputs go from 0 to 1023 while colors in Processing
    // only go from 0 to 255.
    int val = Integer.parseInt(buff)/4;
    // Clear the value of "buff"
    buff = "";
    // Shift over the existing values to make room for the new one.
    for (int i = 0; i < 63; i++)
      values[i] = values[i + 1];
    // Add the received value to the array.
    values[63] = val;
44  Forum 2005-2010 (read only) / Bugs & Suggestions / Communication Examples Broken in Processing on: April 17, 2009, 06:18:21 am
Both the Arduino example sketches VirtualPixel and Graph, appear to be broken in Processing. They throw "array index out of bounds" errors - I may not have that error message wording precisely correct.

This doesn't happen every time but more often than not. There seems to be some condition of serial input, that raises the error condition.

Anyone know if Processing has changed their Serial class, since the examples were written?

45  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Link to Millis() ref page from Blink Without Delay on: May 04, 2009, 06:59:10 am
Good idea. Done.

There used to be an example on the reference page, that illustrated how one would actually use millis(). The Arduino team has decided that they wish to have the reference be more terse however, so the example got changed to kind of useless one.

Pages: 1 2 [3] 4 5 ... 18