Show Posts
Pages: 1 ... 413 414 [415] 416
6211  Forum 2005-2010 (read only) / Bar Sport / Re: Hello! on: February 12, 2008, 04:11:47 am
Hi eustace, if the thread was a discussion with examples of driving robots then the hardware interfacing would be where I would think it would go. Or if its to proudly show what you have built then a thread in the exhibition area would be appropriate. Either way, please do share  smiley.
6212  Forum 2005-2010 (read only) / Bar Sport / Re: Hello! on: February 09, 2008, 10:17:15 am
Hi Carsten, welcome to the arduino.  You should have no trouble finding servo and mouse code for your arduino robot. But give a shout if you need any help.

p.s. if you find a 'show new posts' capability, let me know where it is. It would be very useful.
6213  Forum 2005-2010 (read only) / Uno Punto Zero / Re: internal pullup resistors & digitalWrite on: March 28, 2010, 04:10:12 am
Quote
It kind of mirrors pin 13 with the flashing LED - you can just plug an LED in without worrying about resistors.

Yes you can do that to make things simpler for beginners, but its not good practice.  The current Arduino boards do not have a resistor in series with pin 13 (its only in series with the internal LED) so the typical red LED plugged in directly will exceed the Atmel recommended pin current.

That, and starting off with external pull-downs are the way many people have been introduced to Arduino, but they are not necessarily the best way to learn.
6214  Forum 2005-2010 (read only) / Uno Punto Zero / Re: internal pullup resistors & digitalWrite on: March 27, 2010, 10:34:04 pm
Hi nick,
Quote
This was so you don't have to explain things like the switch pulled the digital in LOW, so digitalWrite HIGH to turn the LED on(it was counter-intuitive to a lot of people).

Yes, a lot of things that beginners need to know can be counter intuitive at first, but explaining it as follows is perhaps clearer:

“when the switch is pushed LOW (digitalRead is LOW) the LED is turned on (digitalWrite HIGH)”

As you say, different people have different takes on this, but FWIW, mine is  that the following code (without the external resistor) is easer:

Code:
void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);      
  // initialize the pushbutton pin as an input with pull-up resistor enabled:
  pinMode(buttonPin, INPUT_PULLUP);    
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pushed Down
  // if it is pushed, the buttonState will be LOW:
  if (buttonState == LOW) {    
    // turn LED on:    
    digitalWrite(ledPin, HIGH);  
  }
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
  }
}
6215  Forum 2005-2010 (read only) / Uno Punto Zero / Re: internal pullup resistors & digitalWrite on: March 27, 2010, 04:57:44 am
Any of the suggestions in this thread would be an improvement but if the two parameter suggestion is semantically clearer then it deserves further consideration

Quote
when you very first start and are introducing the idea of digital input and don't want to introduce to many things at once.
Digital input is almost always introduced using buttons. These require pull-ups so the concept does need to be explained from the start, although often an external pull-up resistor is introduced before internal pull-ups. However I think that many non-technical people would find it easier to get something going if the button example used internal pull-ups instead of the external pull-downs:
  pinMode(buttonPin, INPUT_PULLUP );    
rather than having to understand and deal with : “a 10k resistor needs to be attached from pin 2 to ground” (sounds of user fumbling through pack of components trying to find the correct resistor)

Breaking existing code would be a problem but I wonder if there is any code that relied on the pull-ups being enabled when changing from output mode to input mode. Pull-ups change their state if the pin is switched to output mode and the pin state is changed, so code that does not explicitly set pull-up state when switching from output to input  is a potential source of bugs. Is anyone aware of any code that does switch from output to input that requires pull-ups in a particular state but does not set them explicitly. If not, assuming the current method for setting pull-ups was still supported, old code would not break.
  
6216  Forum 2005-2010 (read only) / Uno Punto Zero / Re: internal pullup resistors & digitalWrite on: March 22, 2010, 09:45:42 pm
Quote
In this case, would INPUT mode explicitly disable the pullup?

I also think this is easy to understand:

INPUT             (input mode without pull-up)
INPUT_PULLUP (input mode with pull-up on)
OUTPUT          (output mode)
6217  Forum 2005-2010 (read only) / Uno Punto Zero / Re: internal pullup resistors & digitalWrite on: March 21, 2010, 09:44:15 am
Quote
it is  more consistent with previous code
Hi Ray, could you clarify what previous code the three element version is consistent with?

Quote
Pins can be defined as output can benefit from a pullups too.
Pull-ups can only be enabled on inputs.  Because of the way internal pull-ups are implemented on the controller chip, an output pin whose value is low cannot have pull-ups enabled.
6218  Forum 2005-2010 (read only) / Uno Punto Zero / Re: internal pullup resistors & digitalWrite on: March 21, 2010, 02:35:45 am
The benefit of pinMode(9,INPUT_PULLUP) is that its more obvious what the code does than  pinMode(9, INPUT, true);
If the user was not familiar with pulls-ups than context sensitive help on  INPUT_PULLUP would get him relevant information.

Or, if you prefer the three argument version, you could define PULLUP as true and use:  pinMode(9, INPUT, PULLUP)
6219  Forum 2005-2010 (read only) / Uno Punto Zero / Re: Developer Request: Sketch Require Hardware on: February 16, 2010, 10:43:38 am
BenF, as Eberhard pointed out in post #3, knowing the processor may not give enough information to determine the capabilities of the board.

But even knowing the board may not be sufficient for a sketch to ensure that all needed resources are available as there is currently no way of determining if and when resources like pins and timers are being used by a library.  This is an issue being looked at by the developers but its not an easy one to solve.
6220  Forum 2005-2010 (read only) / Uno Punto Zero / Re: Areas for discussion. on: April 03, 2010, 01:33:49 pm
Quote
mem - how did you get your example to be in colour?
to get the syntax coloring, from the ide edit menu, select 'copy for forum'

Code:
Serial.print("x ");
Serial.print(x);
Serial.print(" y ");
Serial.print(y);
Serial.print(" z ");
Serial.println(z);  
I think beginners find that ungainly.
There has got to be a better way that does not look scary.
6221  Forum 2005-2010 (read only) / Uno Punto Zero / Re: Areas for discussion. on: April 03, 2010, 12:06:22 pm
Quote
Just to emphasise the point, who can see the error in the operator overloading example?

Code:
Serial << "GPS unit #" << gpsno << " reports lat/long of " << lat << "/" << long;

The IDE highlights keywords so the bug is easy to spot:
Quote
#include <Streaming.h>

int gpsno, lat;

void setup()
{
  Serial.begin(9600);
  Serial << "GPS unit #" << gpsno << " reports lat/long of " << lat << "/" << long;

}

void loop()
{}


Quote
I would observe that this has been referenced several times in this thread, and presumably read, and no one has raised this concern. I think it suggests that it is not easy to understand.

As I mentioned in my earlier post, I do think that the C++ syntax looks a little scary to beginers. I am not clear what concern you feel has not been raised?

I hope this post doesn't come across as argumentative, I suspect we are in agreement that a simpler way to format output would be most welcome.
6222  Forum 2005-2010 (read only) / Uno Punto Zero / Re: Areas for discussion. on: April 03, 2010, 12:25:10 am
That line defines the output capability but it does not need to be visible within the sketch. there is a version that hides that line  in a library: http://arduiniana.org/libraries/streaming/

the downloid is here: http://arduiniana.org/Streaming/Streaming4.zip

I have just modifed the playground article to include the link to Mikal's less scary library version.
6223  Forum 2005-2010 (read only) / Uno Punto Zero / Re: Areas for discussion. on: April 02, 2010, 11:06:13 pm
I like gbulmer's suggested enhancements to serial monitor, and I would add one more – an option to send  '\r' at the end of the string when the Send button is pressed to make it easier for a sketch to determine the end of an input string.

 think that tabular output is needed as much with LCD as with Serial, so would want to see something along the lines of roypardi's suggestion that includes the ability to control the padding between fields so they can be lined up.

The ability to print multiple fields can be done now using a method published by Mikal Hart here: http://www.arduino.cc/playground/Main/StreamingOutput
Its syntax is a C++ standard but I wonder if it looks a little scary to non-technical people?

so for me, the higher priority is something simple that can print a line at a time that includes control over the width of a field so printed values can line up on serial or lcd (or ethernet).  
6224  Forum 2005-2010 (read only) / Uno Punto Zero / Re: Areas for discussion. on: April 02, 2010, 04:16:30 am
I agree with gbulmer that providing the ability to do a tabular layout would be very desirable, although I would vote for implementing this in the print statement. This would enable  LCD, Ethernet and any other classes that inherit  print capability to also align columns of values using the same code.  So my vote is to add some simple formatting capability to print that controlled the width and padding of  a printed value would enable a sketch to align columns on any output device that supported print.

That's not to say that serial monitor would not benefit from enhancements, particularly the support of'\r' so that output can be kept to the same line.
But if Arduino core development resources are limited, then more sophisticated Serial terminal functionality can be obtained by using one of the many open source Serial utilities that can be downloaded for free.
6225  Forum 2005-2010 (read only) / Uno Punto Zero / Re: Variable types in the documentation? on: March 21, 2010, 02:56:51 am
The down side of including the type in the reference is that the type is usually not needed and many beginners would find its inclusion intimidating.

In my opinion, the friendlier solution would be to add a statement in the reference saying something like:  The highest valid frequency value is 32767
Pages: 1 ... 413 414 [415] 416