Show Posts
Pages: 1 ... 56 57 [58] 59 60 ... 71
856  Using Arduino / Programming Questions / Re: Better way, perhaps using pointers? on: December 28, 2011, 10:56:38 pm

Using pointers won't help you
857  Using Arduino / Programming Questions / Re: Arduino ISP Bootload Not Working on: December 28, 2011, 07:19:21 pm
Did you disable auto-reset on the programming arduino?
858  Using Arduino / Programming Questions / Re: Toggle button for analogWrite on: December 28, 2011, 07:18:46 pm
I'd clean up the tabbing (go in 1 tab for each { and go out 1 tab for each }, with few if none exceptions) and the spacing (don't have more than 1 or 2 black spaces in a row). You could also change some of the global variables like ledState, sensorValue, outputValue, buttonState, and lastButtonState to variables just within loop() (most of them will have to be made static). You also have some undescriptive names, like reading and sensorPin. You should also change lastDebounceTime to an unsigned long, since that's what millis() returns. Some comments would be nice as well.
859  Using Arduino / Programming Questions / Re: Toggle button for analogWrite on: December 28, 2011, 06:51:04 pm
how about:
if (ledState) {
  analogWrite(ledStripPin, outputValue);
else {
  digitalWrite(ledStripPin, LOW);
860  Using Arduino / Programming Questions / Re: Creating a library on: December 28, 2011, 06:48:04 pm
Here's the issue regarding it:
861  Using Arduino / Programming Questions / Re: Problem with servo inside a class on: December 28, 2011, 06:39:39 pm

That's not correct and isn't even close to compiling. new returns a pointer -- does my_servo look like a pointer?

OP, you may want to check out initialization lists. I'm not completely sure if they're necessary for constructors that take no arguments (like Servo) but I know they are necessary for constructors that do take arguments.
862  Using Arduino / Programming Questions / Re: Could someone check this code on: December 28, 2011, 03:25:57 pm
What's the difference between ServoPan and PanServo? You never write low to eablepin1 in drivestop, and you never call drivestop (call it when you receive an 's').
863  Using Arduino / Programming Questions / Re: Creating a library on: December 28, 2011, 03:17:26 pm
Try adding #include <EEPROM.h> in your .pde (or .ino) file. I suspect the arduino preprocessor isn't linking in the EEPROM.cpp file.
864  Using Arduino / Programming Questions / Re: Programming Question on: December 27, 2011, 07:57:40 pm
They're called Serial functions.

You call
Serial.begin(/*baud, generally 9600*/ 9600);

once (ie in setup)
and then
Serial.print(/*Number or string*/ "hithere");
to actually print.

To view the messages, you click the "serial monitor" button in the IDE, and make sure the bauds are the same.
865  Using Arduino / Programming Questions / Re: How to include a file without having to make an extra "library" for this? on: December 27, 2011, 02:31:51 pm
Check out the tab feature on the IDE.

If there are multiple .pde (and .cpp files?) files in the same directory, they will get concatenated with your main .pde file, and you can specifically include .h files with #includes with quotes.

#include "fileinsamedirectory.h"
866  Using Arduino / Installation & Troubleshooting / Re: help with mini arduino can't upload sketches on: December 24, 2011, 10:07:09 pm
I think it would help if you said what your operating system was and what version of the software you have.

Do you have the correct serial port and board selected?
867  Using Arduino / Installation & Troubleshooting / Re: "Windows was unable to install your Arduino USB-Serial" on: December 24, 2011, 10:02:28 pm
It doesn't show in the photo, but when you're on the "search for driver software in this location" screen, are you going into the FTDI Drivers subdirectory? You have to make sure you're exactly on the drivers directory.

It's hard to explain but there's..

arduino1.0 -> drivers (select this) -> FTDI Drivers (don't select this)

Other than that, you might want to try redownloading the software or checking (somehow... this is far fetched) that your 8u2 is still in "serial converter" mode.
868  Using Arduino / Programming Questions / Re: Call a method with pointers on: December 24, 2011, 02:05:38 am
I'm thinking of another way... you'd have a function which takes a pointer to another function that takes nothing and returns the button, like..
void phi_prompt::registerGetButtonFunction(int (* getButtonFunction)(void) );

Then you could store the pointer to the function as an instance variable and use it to get the button. Of course, you'd have a default value to "your" get button function.

See here; it sounds like what you're doing:
869  Using Arduino / Programming Questions / Re: Best Practice with millis()? on: December 24, 2011, 01:49:12 am

Oh, I see. Thanks.
870  Using Arduino / Programming Questions / Re: Using teensyduino on Arduino on: December 23, 2011, 07:31:35 pm
So I need to have Teensy.

I can program Teensy with the arduino environment, but not download programs of Teensy to Arduino.

In other words Teensy is an Arduino with more programable features.

Thanks to all.

You can do it with an uno (it's a little tough, but I suspect it's about the same toughness as the teensy). This link may help:
Pages: 1 ... 56 57 [58] 59 60 ... 71