Show Posts
Pages: 1 ... 99 100 [101] 102 103 ... 114
1501  Using Arduino / Programming Questions / Re: How to Run Multiple Functions Independently on: March 05, 2012, 09:35:07 am

Basically no, but the ATMega chip has some neat features that make it pretty good at measuring inputs and generating accurate output pulses and waveforms. The Arduino is a micro controller, not a computer and so a lot can be achieved using the hardware level rather than in software as you would on a computer - the timer/counters being a strong example of this.

As others have said, if you give a bit more detail on what you are doing you will get better advice.

Or If your up to it, read the ATMega328 data sheet for a complete view of what's available.

Duane B
1502  Using Arduino / Project Guidance / Re: Protoshields and things! on: March 05, 2012, 09:14:43 am

My approach is to use old parallel cables, some can be run direct to devices, others such as power I run To strip board and then branch them out to the devices. It's not pretty compared to stacked sheilds, but it's very low cost, very flexible and so much easier than wiring things individually and if your housing your project, no one will ever know  smiley-wink

Duane B
1503  Using Arduino / Motors, Mechanics, and Power / Re: Detailed How To Posts - Reading From An RC Receiver on: March 05, 2012, 08:52:57 am
Hi Erni,

Thanks for taking the effort to check the performance of a 2.4 System, I expected that they would be better, but from your data its a lot better than i expected. Maybe I should not be so suprised after all my equipment uses technology that hasn't really changed since 1980.

I keep using the excuse that I am as fast around the track as anyone else as a reason not to upgrade, but just this weekend I was testing my Arduino based lap timer in a regular spot and someone somewhere unseen was interfering with my car. Maybe now that there are so many toy cars, helicopters and 'walky talkies' around that use 27 and 40 MHz It might finally be time for me to enter the 21st century and get a 2.4 system.

For anyone that does not have an existing collection of 27 or 40 MHz equipment your results would suggest there is no excuse to buy the older technologies.

Duane B
1504  Using Arduino / Motors, Mechanics, and Power / Re: Detailed How To Posts - Reading From An RC Receiver on: March 05, 2012, 03:20:42 am

Thanks for the feedback.

I had to look up 14 channel transmitters, I guess it is the Futaba one you have ?

What is is that you are building with so many channels ?

I have a post about a sneaky way to add on/off toggle channels here -

Not that you are going to be running out of channels any time soon.

Duane B

1505  Using Arduino / Programming Questions / Re: Passing class-member function to another class on: March 05, 2012, 12:58:08 am
   In a purely OO environment, the approach suggested above would work very nicely however while many Arduino libraries implement classes, they tend to be implemented to work with C rather than a pure 00 approach. The Alarm class expects a C function and will not work with interfaces however if you really want to use an OO approach, you could rewrite the Alarm library to work with interfaces, the previous poster has provided a good template.

   Then again, how much new code and reinventing of existing code do you really want to do to toggle a pin ?

Duane B

1506  Using Arduino / Project Guidance / Re: Slotcar speed controller with display and electronic memory project on: March 04, 2012, 09:38:08 am
   Its possible that this is another library which has not been updated to work with Arduino 1.0, there are quite a few, there is an easy fix if you search.

Duane B.
1507  Using Arduino / Programming Questions / Re: Passing class-member function to another class on: March 04, 2012, 04:45:06 am
   Quoting from the link provided by the previous poster -

[33.2] How do I pass a pointer-to-member-function to a signal handler, X event callback, system call that starts a thread/task, etc?


As I mentioned in my original response, an object orientated approach is valid, but in a micro controller you are much closer to the hardware and sometimes it good to acknowledge this and enjoy the differences.

If you want to continue with the OO approach, I would suggest that you revisit your objects so that they are less tightly coupled - i.e. should the alarms be inside the heat tape object - could you achieve what you want more easily if they were outside ?

Duane B.
1508  Using Arduino / Programming Questions / Re: Passing class-member function to another class on: March 04, 2012, 02:30:18 am
   From very distant memory, you can only pass a static function as a callback function, static functions are associated with the class, not any individual instance (object) of the class so you will not have access to your object variables, only status variables.

   As all your doing is turning pins on and off, I might suggest that you take off your perfectly valid but may be out of context 'object orientated' hat and put on your microcontroller 'how can i get this done in 2k memory' hat and have another look at what your trying to do.

   Just a suggestion and there is nothing wrong with trying to do it in objects other than in this case your are inventing problems for yourself - i.e. how do I use half a dozen layers of complexity to change a pin.

Duane B

1509  Using Arduino / Sensors / Re: Suggestions on IR communication on: March 04, 2012, 01:01:34 am
   No need for headers, the problem you have is a very simple one that has been solved for over 40 years - how to get multiple proportional channels into a single transmission channel.

Read my last post again (and again if need be) and pay particular attention to the 'heres how' part.

I can put it another way which is - each channel has a fixed position within a fixed frame. If we dont see any pulses for a period we know the frame has ended and the next pulse is the first channel of a new frame, the pulse after that, the second channel. The order of the pulse within the frame gives us the channel number, the width of the pulse gives us the proportional signal for that channel.

something like this


Duane B

1510  Using Arduino / Sensors / Re: Poor performance of IR LED on: March 04, 2012, 12:55:29 am
   Are you using the setup inside or outside, is there a lot of natural light around, maybe coming in through a window, if so try a shade around the camera sensor - without a shade my lap timer does not work at all, with a small matt black cardboard tube around the sensor it works flawlessly.

   Also try driving the LED with more current, I am driving mine with 100ma - obviously not directly from an Arduino PIN. You mention that you are sending a signal, I assume that this is a 38Khz coded signal of some sort in which case the LED is off a lot of the time and can be driven harder.

   To get a wider angle from a single LED, reflect it off something, try a quick experiment like pointing the LED up and reflecting if off your hand towards the camera, you will get a much wider viewing angle - a sheet of white paper or aluminium foil in a small housing for your transmitter will do the same but much more efficiently.

    I am using IR Emitters and Detectors for an RC Car lap timing project here -

    EDIT: If you off load generating the 38Khz IR signal to a 555 timer, you can drive the LED harder and use a potentiometer to tune the frequency which will both help with range.

Duane B



1511  Using Arduino / Sensors / Re: Suggestions on IR communication on: March 03, 2012, 01:04:50 pm
   To tell which channel a pulse is for I would suggest an approach similar to radio based RC Systems. They use a fixed frame which contains all of the channels as consecutive pulse widths. If you use the servo library you can cheat a bit and get it to do most of the work for you.

The servo library automatically generates pulses using a 20ms frame, the pulses for each channel within the frame are between 1 and 2ms long.

See here for background -

The problem is that the Arduino Servo library doesn't quite do this in exactly the same way as an RC transmitter, but by using one dummy servo we can fake it so that its close to an RC Transmitter signal and will allow us to get two channels in and out of the signal.

Heres how -

1) Create a throttle servo and attach it to a throttle pin
2) Create a dummy servo and attach it to an unused pin
3) Create a steering servo and attach it to a steering pin

We use the dummy servo to create a 1.5 ms  space in the signal between the throttle and steering pulses.

Note: 1.5ms is the default pulse width we could change it.

In our receiver code we can work on the basis that -

1) If we haven't seen a pulse for over 10ms the pulse we are looking at now is the throttle
2) If we saw a pulse less than 2ms ago, that was the throttle and the current pulse is the steering.

The dummy servo is not used, but because of the way the Arduino Servo Library is written, we need this to create a gap between the end of the throttle and the start of the steering pulses within our single IR Channel.

You will need a small circuit to allow the throttle and the steering pins to activate your IR Emitter, or you can cheat and do a quick test with two IR Emitters if you have them - just for testing ;-)

Some IR Detectors have rules about the types and sequences of pulses that they will process, if that is the case with yours I am sure we can work around it.

Duane B
1512  Using Arduino / Project Guidance / Re: Slotcar speed controller with display and electronic memory project on: March 03, 2012, 10:24:55 am
Hi Backbone,

Looking at all the sections of your code that are commented out, it looks like you should start using versions.  Strip out all the commented out code and save your project as SCSC_V1. If you add another feature, make it version 2 and so on. If you get to version 7 and something doesn't work its great to have six earlier versions that do to fall back on.

I do this all the time and it saves so much time.

Duane B.

1513  Using Arduino / Programming Questions / Re: Precompiler directives - is there a case statement? on: March 03, 2012, 05:57:27 am
   There are just if, elif, else and endif. If you look through the source code for the Arduino libraries you will see how these are used for a similar purpose to yours - they are sometimes used in combination to deal with the different Arduino processors (ATMega8,168,328 etc) and different clock speeds.

If you look in Servo.cpp you will see what appear to be nested directives - something I didn't know was possible until seeing it now !

Duane B

1514  Using Arduino / Project Guidance / Re: Slotcar speed controller with display and electronic memory project on: March 03, 2012, 05:28:19 am

Thats standard behaviour for an UNO, to reset on serial connection. I am sure there arensimple work arounds if you search for 'UNO disable auto reset'

Duane B
1515  Using Arduino / General Electronics / Re: Dont Waste Your Time on: March 02, 2012, 01:59:39 pm

I will get the wife to pick some up when she is in Europe next month, I am also desperate for heat shrink small enough for component wires. In Dubai you can buy the parts to start anything whatever your interests are, you just can't buy the parts you need to finish it.

There is a metaphore for The city as a whole in there somewhere.

Duane B

Pages: 1 ... 99 100 [101] 102 103 ... 114