Show Posts
Pages: 1 [2] 3 4 ... 67
16  Development / Other Software Development / Re: Adapting iPod Control Libary to use NewSoftSerial on: March 31, 2011, 10:03:13 pm
I don't think there's any need to make a no-argument constructor to do what you want.  In C++, if you want to build a class that contains another class like NewSoftSerial, you do it this way:

Code:
class iPodControlNSS
{
  NewSoftSerial nss; // declare the member

public:
  // Here's a constructor that passes its parameter onto nss
  IPodControlNSS(int rx, int tx) : nss(rx, tx)
  {
    ...
  }
  ...

  void begin() { nss.begin(57600); }
};

17  Using Arduino / Project Guidance / Re: custom short USB cabling on: February 18, 2011, 10:18:27 am
@CodingBadly: Yes, something similar to that, but preferably not $13 apiece.  (I'm having difficulty with a relatively simple cable that costs 30% of the costs of the electronics.)

@robtillaart: What I need is a cable that mates with the Nano on one end.  I thought about those motherboard-style cables, but they don't have the correct connector.  (I don't think it's easy to access the Nano's USB signal path without going through that connector...)

Thanks,

Mikal
18  Using Arduino / Project Guidance / custom short USB cabling on: February 17, 2011, 02:02:32 am
I am working a number of projects that employ Arduino Nanos mounted deep inside enclosures.

I wish to expose the Nano's USB bus to the exterior of the enclosure via a standard USB-B (female) connector, just like the one that the Uno has.

The way I am currently doing this is physically cutting a standard USB "mini" cable and soldering the exposed wires to a USB-B connector mounted on a custom PCB.  So the intact end of the cable is plugged into the "mini" port on the Nano and the other end -- the one with the soldered connector -- is mounted in a hole in the exterior.

These cables take me a relatively long time to make and are not very pretty.  Does anyone know of a resource who would custom make these cables?  (And not for $50 apiece!  I'm hoping for more like $5-7.)

Many thanks,

Mikal Hart
19  Forum 2005-2010 (read only) / Troubleshooting / Re: How do I use AVR studio? on: October 05, 2008, 09:14:30 pm
I wish the documentation was more clear about that, too, techx.  I think a lot of C++ programmers would be attracted to this if they only knew it was C++!

Yes, you must provide a loop() and setup() function (and you can't provide a main()).  But beyond that, you can do almost anything C++ you want.  Make any functions, classes, create objects, call runtime library functions, etc. etc.  Try it!  It's all good! smiley

Mikal
20  Forum 2005-2010 (read only) / Troubleshooting / Re: How do I use AVR studio? on: October 05, 2008, 08:54:52 pm
Quote
I think the arduino environment qualifies as "real" C, C++.

Absolutely right!  It's not overly well publicized fact, but the Arduino IDE -- the package that you download on the main arduino.cc site -- is pure, unadulterated C++!  (Well, very slightly adulterated.)

It took me a few days to figure this out, but boy am I happy about that!

Mikal
21  Forum 2005-2010 (read only) / Troubleshooting / Re: Bug using NewSoftSerial & Servo.h together on: April 01, 2010, 06:42:29 am
minhtue86,

I think your problem almost certainly stems from dropped characters from your sensor.  You should migrate to NewSoftSerial or Serial.  SoftwareSerial RX and delay() do not play well together.  Every time you do a delay(15), you are missing whatever important data arrived from your sensor.

Mikal
22  Forum 2005-2010 (read only) / Troubleshooting / Re: Bug using NewSoftSerial & Servo.h together on: January 14, 2010, 12:16:44 pm
No, I haven't, mem.  But you're right that there would almost certainly be a conflict.  

I added an end() method in NewSoftSerial 10 (now in beta) that allows for you to turn off a NewSoftSerial interrupt stream.  (Previously, interrupts were enabled forever.)  

Could someone test this with Servo and Tone, i.e. start a NewSoftSerial stream, turn it off with end(), run a Servo, play a Tone, then turn NSS back on with begin(...)?

http://arduiniana.org


Mikal
23  Forum 2005-2010 (read only) / Troubleshooting / Re: Bug using NewSoftSerial & Servo.h together on: December 29, 2009, 06:59:48 pm
Hi all--

I can officially confirm that NewSoftSerial (and really any software serial library) is incompatible with the new Servo library that ships with Arduino 0017.  The problem is that the new Servo library, which is really quite cool, depends on reliable interrupts, where software serial solutions require interrupts to be disabled -- at least for short periods of time.  I discovered this issue when I was trying to upgrade my Reverse Geocache box to 0017, and the only workaround I could come up with was to downgrade the Servo library back to 0016.

I wonder if it would be possible to retain both libraries in 0018?

Mikal
24  Forum 2005-2010 (read only) / Troubleshooting / Re: i2c Pressure Sensor on: October 12, 2008, 10:27:11 pm
Yeah, also remove the #define of abs() in wiring.h.

Mikal
25  Forum 2005-2010 (read only) / Troubleshooting / Re: i2c Pressure Sensor on: October 12, 2008, 09:58:08 pm
Right-o!  maca, if you follow mem's example and add the #ifdef/#endif to your copy of wiring.h (effectively removing the five #defines in between), you will probably get happiness.

Mikal
26  Forum 2005-2010 (read only) / Troubleshooting / Re: i2c Pressure Sensor on: October 12, 2008, 09:42:54 pm
Mem, I *haven't* tried this code, but these are exactly the types of errors (stdlib.h:80) that people get when compiling old libraries with 0012.  My guess is that it works for you because you disabled or undefined those pesky "function-style" cast macros in wiring.h"?  If so, perhaps you'd care to share your method?

Mikal
27  Forum 2005-2010 (read only) / Troubleshooting / Re: Clock with Arduino on: September 08, 2008, 10:52:18 am
Joker,

The express you propose,

elapsed_time = (max_counts + this_tick - last_tick) % max_counts;

is indeed more succinct and readable than the equivalent

if (this_tick < last_tick)
  elapsed_time = max_counts + this_tick - last_tick;
else
  elapsed_time = this_tick - last_tick;


However, I think you'll find that many programmers opt for the latter for the simple reason that in most computer architectures the modulus operation is much more costly in terms of CPU consumption.

Cheers,

Mikal
28  Forum 2005-2010 (read only) / Troubleshooting / Re: NewSoftSerial on 0017 on: October 15, 2009, 05:22:19 pm
Thanks for the update.  I'm glad that it's working.

Mikal
29  Forum 2005-2010 (read only) / Troubleshooting / Re: NewSoftSerial on 0017 on: October 15, 2009, 03:53:33 pm
Hi Rene--

Could you share the error messages more explicitly?  That might help me help you figure out what's going wrong.

Mikal Hart
30  Forum 2005-2010 (read only) / Troubleshooting / Re: NewSoftSerial doesn't work on: August 11, 2009, 05:36:07 pm
That code looks fine now.  My guess is that you are hooking RX to RX and TX to TX.  It should be TX  to RX and RX to TX.  Whatever you initially connected to pin 0, now connect it to pin 2.

Mikal
Pages: 1 [2] 3 4 ... 67