Show Posts
Pages: [1] 2 3 ... 24
1  Using Arduino / Programming Questions / BitSet(N) for large N on: March 10, 2013, 07:37:20 pm
Did I see somewhere here or elsewhere some routines or library for read/write of an arbitrary-large array of "bits".

Something like STL bitset<N> ... I did see that there is an STL port (attempt?) but is it clean/easy to install?  Other alternatives?

Thanks,
John
2  Using Arduino / Programming Questions / Re: Arduino Intervalometer - One Button to Cycle Through Modes on: March 10, 2013, 06:01:46 pm
There are two events that are going on here, so you need two independent parts to your loop code
   * Button Pressed
   * timer has Elapsed

Code:
Pseudocode
loop()
   // Handle the Button Press:
    if the button has been pressed
        increment the mode, or roll over to zero
        set the interval

   // Handle the timer elapsing:
   if mode != 0
         if  ( now - lastPictureTime > interval )
              snap the Picture
              lastPictureTime = now

Hope this helps!
John
3  Using Arduino / Programming Questions / Re: Wierd PID results on: March 10, 2013, 10:18:51 am
Quote
And on the end its like the pid just shutdown itself.

What do you mean by this, it stopped working altogether?  If you post your sketch it would be helpful...
4  Using Arduino / Programming Questions / Re: Wierd PID results on: March 10, 2013, 09:51:45 am
Maybe there is a bug in your code?  Are you using a library, or did you write it?
5  Using Arduino / Programming Questions / Re: Traffic light circuit help? on: March 05, 2013, 05:16:21 pm
Could you use a wire and connect pin 2 to 5V and to GND ?
I can't see what the problem is with the code, so I want to be sure that pin 2 is high and low.

Poor phrasing, that!
6  Using Arduino / Programming Questions / Re: RTC Gurus please Help me on: March 05, 2013, 02:15:54 pm
Looks to me like there should be a Wire.begin() in there...
7  Using Arduino / Programming Questions / Re: Question about sprintf and memory allocation on: March 05, 2013, 11:45:04 am
Code:
void makeText () {
  char myText[4];
  sprintf(myText, "%02d, %02d ",day(),year());
  showDate(myText);
}
...
In the second case it has nothing to do with sprintf.  In the second case you've declared a local variable.  As soon as that function returns that variable goes out of scope.  So you can't use it anywhere else.  The same would happen if it was an intended variable and you had just done a simple assignment.

No, nothing wrong with passing the local variable to another function as in the above code.

The problem is probably putting the 8 characters into the 4 character array.  bratan, you need by my count myText[8] to hold what you're trying to put in there ("11, 22 " plus the end of string character)

Cheers,
John
8  Using Arduino / Programming Questions / Re: RTC Gurus please Help me on: March 04, 2013, 06:04:40 pm
Its the one from adafruit tutorial on github:https://github.com/adafruit/RTClib

If you compare the  "ds1307" example with the "softrtc" example from the library, it will become clear...

You want to use the "ds1307" example.  smiley

Cheers,
John
9  Using Arduino / Programming Questions / Re: Programming Style on: March 02, 2013, 09:54:22 pm
@Lefty:

Oops smiley
10  Using Arduino / Programming Questions / Re: Programming Style on: March 02, 2013, 09:34:14 pm
@OP

I too don't care for Egyptian Style.  #3: http://www.codinghorror.com/blog/2012/07/new-programming-jargon.html

K&R for me...
11  Using Arduino / Programming Questions / Re: Delays and unsigned long on: March 02, 2013, 11:30:30 am
@Jim_Socks

Looks great!  It's really coming along!

How are you going to do the sensors for the glasses on your "carousel"?

Cheers,
John
12  Using Arduino / Programming Questions / Re: How to show only $GPGGA sentence in GPS using Arduino mcu? on: March 01, 2013, 10:08:42 am
sure?
No.
13  Using Arduino / Programming Questions / Re: How to show only $GPGGA sentence in GPS using Arduino mcu? on: March 01, 2013, 09:08:56 am
hmmm if
Serial.print("$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29"); //can turn on only the second sentence (GPRMC)

Serial.print("$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28"); //can turn on GPRMC and GGA

how bout turn only GGA?

Serial.print("$PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29"); //can turn on GGA?
14  Using Arduino / Programming Questions / Re: Setup function not running due to initialized class? on: February 28, 2013, 09:45:32 pm
I guess I dont understand what is nonsense about it?
Im sorry I just tinker, I am not a programmer by any means.

They're trying to tell you that in your constructor you are wanting to set the values of your instance ("member") variables, yet you are creating local ("function") variables which are "hiding" the instance variables.

You have:
Code:
Artnet2::Artnet2()
{
bool matchArtnet = true;    // set values of "new" local variables
char _artnetHeader[] = "Art-Net";
int _channel_position = 1;
int _number_of_channels = 512;
// discard the above local variables
// and the instance variables are unaffected
}
But you want:
Code:
Artnet2::Artnet2()
{
matchArtnet = true;      // set values of existing instance variables
_artnetHeader[] = "Art-Net";
_channel_position = 1;
_number_of_channels = 512;
}

HTH,
John
15  Using Arduino / Programming Questions / Re: Esplora setup loop problem? on: February 28, 2013, 09:33:12 pm
I'm trying to write code that lets me use Esplora board to control a robot. When I start the code, it is supposed to set up the servos to center position but nothing happens until I press the joystick button. How can I fix the problem?

Code:
   robotstand01; < nothing happens here
...
    robotstand01(); < it works.

Seriously?
Pages: [1] 2 3 ... 24