Show Posts
Pages: 1 ... 97 98 [99] 100 101 ... 114
1471  Using Arduino / Motors, Mechanics, and Power / Re: Servo problem (it doesn't turn good) on: March 13, 2012, 02:40:39 am
Hi,
   You do not need to calibrate the Servo library and I cant see why you would need to calibrate this servo either.

Did you write your own code or use the servo sweep example ? - I suggest that you use sweep as the initial test.

Did you connect a common ground between the servo and your arduino ?

How are you powering the servo ?

Duane B

rcarduino.blogspot.com
1472  Using Arduino / Project Guidance / Re: best way to extend serial lcd connectors off the protoboard on: March 13, 2012, 02:32:31 am
Hi,
   I use old parallel cables soldered to PCB Headers, the allows me to quickly plug and unplug projects without having to think where each individual wire should go. This should work over the distances you have mentioned.





Duane B

rcarduino.blogspot.com
1473  Using Arduino / Programming Questions / Re: Object oriented or not? on: March 11, 2012, 07:39:16 am
Hi,

Quote
Fine. But, if the job was to develop code for embedded processors, and your app consumed 4 GB of ram, that would not then scale to the intended job target.

Quite right, I am always open to changing my mind, so would anyone like to offer some great examples of OO being used to build projects by forum members, thats OO, not here is a class in a library.

Duane B

rcarduino.blogspot.com
1474  Using Arduino / Programming Questions / Re: Object oriented or not? on: March 11, 2012, 07:16:57 am
Hi,
   Based on the examples within this branch of the forum, most people that attempt to write OO for Arduino tend end up to writting the problem to fit the solution. Maybe you can write great OO for Arduino but OO requires more than a collection of standalone libraries created as classes.

   If I was taking a test as part of a job interview and the test was - 'write something that makes elegant use of OO to solve a problem' and I was offered a PC or an Arduino, I would take the PC.

   As the OP is looking for confirmation on an approach for a college project he is in a similar situation and my advice to him/her is the same I would give myself.

Duane B

rcarduino.blogspot.com



   

1475  Using Arduino / Programming Questions / Re: Object oriented or not? on: March 11, 2012, 06:04:24 am
Hi,
   Lets wait and see what the OP comes up with ...

Duane B

rcarduino.blogspot.com
1476  Using Arduino / Programming Questions / Re: Object oriented or not? on: March 11, 2012, 05:43:20 am
Hi,
   All of which are already provided, I have no idea whats expected of students these days, but presumably more than just using some existing libraries or writing a single standalone class and calling it OO.

Duane B

rcarduino.blogspot.com
1477  Using Arduino / Programming Questions / Re: Object oriented or not? on: March 11, 2012, 05:25:06 am
Hi,
    I thought I would wait for someone else to put their head above the trench first, but yes I would agree with westfw that Arduino is probably not the best environment to showcase your OO skills.

Duane B

rcarduino.blogspot.com





1478  Using Arduino / Programming Questions / Re: Function() vs Speed on: March 11, 2012, 03:39:37 am
Hi,
    Thanks, seems reasonable enough and further reinforces the point - 'make it so you can read it and let the compiler worry about the rest'

    Duane B

rcarduino.blogspot.com
1479  Using Arduino / Programming Questions / Re: Function() vs Speed on: March 11, 2012, 03:17:52 am
Hi Chaps,

    I am still a little confused. In the case of a non trivial function, lets assume that its sufficiently complex to require half of the available registers -

1) Is the compiler sophisticated enough to only push/pop the required registers

and

2) If yes to 1) why is it not smart enough to do the same for and ISR ?

Duane B

rcarduino.blogspot.com
1480  Using Arduino / Programming Questions / Re: How long to toggle an output pin? on: March 11, 2012, 03:15:05 am
Hi,
   To be fair, the concept of having direct access to and the syntax for setting the bits in the registers can look a bit unfamiliar if you are coming from a high level language.

   Back to the OP, its so much easier than it looks, but again if you let us know what you ultimately want to achieve there is almost certainly a similar example such as nick's or an off the shelf library.

Duane B

rcarduino.blogspot.com
1481  Using Arduino / Programming Questions / Re: How long to toggle an output pin? on: March 11, 2012, 02:34:02 am
Hi,
   Its actually much easier than you might think. There are only three or four registers involved, you set them up once and then forget about them. If you give us some details of what you are actually trying to do, there may even be an off the shelf library available to do the dirty bits for you.

Duane B

rcarduino.blogspot.com
1482  Using Arduino / Programming Questions / Re: Function() vs Speed on: March 11, 2012, 02:29:20 am
Hi,
    I remember reading a post somewhere on the overhead of an ISR and in that case, the overhead was quite high due to saving and restoring 'all' of the registers. Surely any reasonably complex function is likely to overwrite at least a few registers and therefore the compiler should be pushing and popping.

The ISR post suggested that there was a standard prolog and epilogue to calling and ISR which added about 55 cycles if I remember correctly.

Am I missing something, are ISRs fundamentally different in the way that registers are preserved ?

Found it, here is the original post to which I am referring - http://billgrundmann.wordpress.com/2009/03/02/the-overhead-of-arduino-interrupts/

Duane B

rcarduino.blogspot.com
1483  Using Arduino / Sensors / Re: IR leds and 38KHz receivers as a optoencoder or similiar on: March 11, 2012, 01:01:19 am
Hi,
   As the previous poster has said, all you need to do is switch the IR Led on and off at 38Khz. There are examples for doing this using an Arduino Timer if you search for 'Arduino 38Khz'. I would suggest that you drive the IR LED using a transistor rather than directly from an Arduino pin, this will allow you to drive it with a higher current, again you can probably find examples of this in the search results.

   You could also drive the IR Led from a 555 Timer, the 555 timer would generate the 38Khz signal and then all you need to do on your Arduino is use the 555 Timer 'reset' pin to control when the Timer is active or not.

   As the previous poster mentioned, most IR Receivers will reject a constant 38Khz signal after a short period, my own set up for an RC Car Lap Timer rejects the 38Khz pulse after about 2 Seconds, in my application this is not a problem as I am only interested in detecting the initial presence of the car in the detection zone.

   If your application requires you to test for the continued presence of an IR Signal, you might get away with generating a dummy signal, you may not be interested in the contents of the signal, but it will be enough to keep the receiver happy.

   Based on my own experience a valid signal still requires a gap in the signal transmission during which the output of the IR Receiver will return to the high state so this approach is not suitable for very high speed beam breaking type applications as the beam may be broken during a transmission gap with no means for you to detect it.

   If your application can work with gaps longer than a few ms, you should be ok. If you just need to detect reflection, transmission or beam breaking over short distances you can use a normal IR (not demodulated) Detector.

   If you describe what you are aiming for as an end result we guide you in the right direction.

   Duane B

rcarduino.blogspot.com




1484  Using Arduino / Programming Questions / Re: How long to toggle an output pin? on: March 11, 2012, 12:43:35 am
Hi,

    As many others have suggested, use the timers, these are implemented in hardware and are directly driven from the system clock, they are not effected by any code that may be running. If you try and implement the same in software, even if you had the correct offsets for the overhead your pulses might still be wrong because your code is not able to take account of any interrupts that might occur, your code will be stopped while these interrupts run leading to inaccuracy in your timing, the hardware timers are not effected by this.

   If your look up Timer1 and the output compare registers OCR1A OCR1B in the datasheet you should be able to work out how to toggle a pin very precisely. If you want a steady pulse rather than a one off pulse, look up the waveform generation modes again these are in the Timer1 section of the datasheet.

Duane B

rcarduino.blogspot.com

1485  Using Arduino / Programming Questions / Re: Function() vs Speed on: March 11, 2012, 12:36:01 am
Hi,
   Are call and return only 4 cycles each ? I would have thought that more cycles are required for pushing and popping the stack ?

   Duane B

rcarduino.blogspot.com
Pages: 1 ... 97 98 [99] 100 101 ... 114