Show Posts
Pages: [1] 2 3 ... 16
1  Using Arduino / General Electronics / Re: Software serial to externally powered device - no good? on: July 12, 2013, 08:44:38 pm
Say you have two cardboard boxes. Each has a bottom. You could call the bottom "ground" and inside the box you can make a mark, say 5 centimeters high.

The two bottoms could easily be different with respect to each other. One might be on the floor and one on a cupboard. Just calling them "ground" or "bottom" doesn't change that.

In order for the 5 centimeter marks to line up, the bottoms have to line up. So you have to have both boxes sitting at the same height. In other word, "connect the grounds".

But that explanation seems contingent on there being a difference in grounds.  E.g., two circuits powered by identical batteries still can't communicate, can they?


Would it be correct to say that a digital input requires at least some current to flow, even if uA?  Thus without common ground no current can flow.
2  Using Arduino / Programming Questions / Re: Save a life and a project please!!! on: June 05, 2013, 01:07:17 am
Your code for button2 appears to turn off the chip enable line at the end.  Hence nothing happens until you re-enable it at the beginning of your button1 code.


Edit:  ninja'd
3  Using Arduino / Programming Questions / Re: Program only works correctly after re-uploading at each start-up. Why? on: May 30, 2013, 03:17:56 pm
You might experiment with adding a delay to the beginning of your game code.
4  Using Arduino / Programming Questions / Re: Why is my code acting like that? on: April 29, 2013, 01:11:37 am
I am not familiar with the DHT22 library, but should you be passing the DHT22 by value as a parameter to your read function?  This is a guess, but I think the function will be creating its own instantiation of a DHT22 when you do that, which it probably not what you want.

Perhaps pass a pointer to your DHT22 object instead:
Code:
...
DHT22_PrintData( &DHT22_0 );
...
void DHT22_PrintData( DHT22* device)
{
  switch ( device->readData() )
...

5  Using Arduino / Programming Questions / Re: return array of uint8_t, why i can un C++ and cant in arduino IDE 1.0 on: April 23, 2013, 11:19:19 pm
The latest version of the Arduino source (1.0.4) already incorporates these changes.  That's what I was looking at when I thought they were implemented:

https://github.com/arduino/Arduino/commit/141684d4


Code:
int * ptr = new int[ payloadSize ];

The case with int actually does not compile on 1.0.1.

6  Using Arduino / Programming Questions / Re: return array of uint8_t, why i can un C++ and cant in arduino IDE 1.0 on: April 23, 2013, 02:24:06 pm
The Arduino implements the new operator, but not the new array operator. The Arduino does not have enough memory for that, generally, so you are encouraged (required, actually) to find alternatives.

If that were the case, wouldn't the case with int fail as well?

In new.h:

Code:
void * operator new[](size_t size);

Is this the operator the compiler is trying to use?
7  Using Arduino / General Electronics / Re: Bouncing exceeding 200 ms on: April 22, 2013, 03:18:52 pm
Hardware debouncing might be your friend;  see http://www.ganssle.com/debouncing-pt2.htm for some ideas.

I have used the RC solution with a model railroad system, where contact between the wheels and rails can be extremely dirty/bouncy.  


But if you need to detect a button release in less than the bounce time I'm not sure there is a decent solution.  At least hardware debouncing has the advantage of automatically "integrating" the amount of time the button is in the closed state.
8  Using Arduino / Programming Questions / Re: Array of pointers to objects on: February 13, 2013, 11:17:57 pm
Are you saying the constructor is called when you declare the array of pointers?
9  Using Arduino / Programming Questions / Re: Does Arduino have a problem with pointers to classes? on: February 02, 2013, 01:31:53 am
One could also put the class definition in a .h file, and #include the .h file in your main sketch.

10  Using Arduino / Programming Questions / Re: New User with Compiler Questions on: January 26, 2013, 02:46:32 pm
One can define and instantiate different things depending on which board is targeted, can't you?  E.g., hardware serial instantiates more serial objects depending on the target's UARTs:

Code:
#if defined(UBRRH) || defined(UBRR0H)
  extern HardwareSerial Serial;
#elif defined(USBCON)
  #include "USBAPI.h"
//  extern HardwareSerial Serial_; 
#endif
#if defined(UBRR1H)
  extern HardwareSerial Serial1;
#endif
#if defined(UBRR2H)
  extern HardwareSerial Serial2;
#endif
#if defined(UBRR3H)
  extern HardwareSerial Serial3;
#endif

I suppose you could define constants like "PIN47" that would be valid only for a particular board if you were really keen on providing compile-time hardware constraints - not that I think it would be a good idea!
11  Using Arduino / Programming Questions / Re: runtime error... memory overload? on: January 23, 2013, 06:55:57 pm
Code:
startOfNextPhoto = photosTaken * photoLength;

If you anticipate that photosTaken * photoLength will be greater than the value of an int (32,767) then I think you need to tell the compiler to work with long values in the multiplication:

Code:
startOfNextPhoto = (long)photosTaken * (long)photoLength;

Otherwise the result of the multiplication will be an int rather than a long.


Of course unless you are using negative numbers you might as well use unsigned ints and unsigned longs.
12  Using Arduino / Programming Questions / Re: Controlling a Kodak Slide Projector via RS232 (P-Com Protocoll) on: January 22, 2013, 04:42:08 pm
Are you inverting the serial data from TTL to RS232 in hardware?  From the documentation the projector expects RS232-level signals.
I think you can try inverting them with Softserial, but that assumes the projector is happy with 0-5v signals rather than true RS232.

As far as i know RS232 is somewhat a NRZ Code, so couldn't be emulated with TTL Levels?!

I missed the part in the original post where you specified that you were using a MAX232;  never mind!
13  Using Arduino / Programming Questions / Re: Controlling a Kodak Slide Projector via RS232 (P-Com Protocoll) on: January 22, 2013, 02:29:45 pm
Are you inverting the serial data from TTL to RS232 in hardware?  From the documentation the projector expects RS232-level signals.

I think you can try inverting them with Softserial, but that assumes the projector is happy with 0-5v signals rather than true RS232.
14  Using Arduino / Programming Questions / Re: Calling function from variable on: January 16, 2013, 10:05:49 pm
Are 'mlt' and 'mlf' integer constants?  If so, I would use Mikal Hart's Flash library and create a table that holds your values:

Something like:

Code:
FLASH_TABLE(int, servovalues, 6, {mlt, 1600, mlf, 1600, 500, 0}, {values for b}, {values for c}, etc... );

That is, you have a table of 26 rows, each row containing the parameters corresponding to a particular character.  Then just look up the appropriate row in the table based on the character received, and pass those values to move2.
15  Using Arduino / Programming Questions / Re: Variable declaring problem on: January 16, 2013, 04:43:30 pm
1) You need to declare soil as an array.  As your code stands, you would need to declare
Code:
int soil[7];
so you could reference members 1 to 6.  If you number your sensors 0 to 5 instead you could declare it to have only 6 members.

2) You would reference the array as a member of mydata:
Code:
mydata.soil[sensor] =  . . .

3) You declare val2 but never use it;  I think you intend to use (val1 + val2) rather than (val1 + val1) ?
Pages: [1] 2 3 ... 16