What would help is for you to look at the Servo library. It uses different timers for different pins. If you can figure out which pins don't use timer 2, then you can diddle with timer 2 for the radar thing.
That issue is completely separate from your misunderstanding of how to read serial data.
dattasaurabh82:
comments are comments right? those are meant to check the speed results in the serial monitor.
Now I'm just porting the frequency data to the port from the arduino & TRYING TO ACCEPept slider value from the port to the arduino.
I'm not that much High end with timers though. I explained my aim also that why i need those timer interrupts as then the radar won't work.
They are just comments, but if you uncommented them then they would be very dangerous. They should never have been there in the first place, and the fact they're there makes me doubt that any of the other code relating to timers has been implemented correctly.
It doesn't sound as if you have any reason to use timers, so I suggest you don't.
only one servo is to be controlled. As suggested I should check & change the pins as it might be using timer 2. timer 3 pins with PWM or ADC could be assigned. But where to check this thing in servo lib?
Tried all the PWM pins & few analog pins. Didn't work. when I checked the servo.cpp, I found none of the AVR family use timer 2 . they use timer 1 & 3 only. then where's this coming from?
dattasaurabh82:
only one servo is to be controlled. As suggested I should check & change the pins as it might be using timer 2. timer 3 pins with PWM or ADC could be assigned. But where to check this thing in servo lib?
If you only ever need to send one servo position over the serial port and know that you will never need to send anything else, you could send the position in a single binary byte holding the required position (0 .. 255) representing the range of positions that the servo supports. That means you can avoid the slight complexity involved in using a textual encoding scheme, as long as those caveats are acceptable.
If you want to find out how the timers are used as standard then I recommend looking for a tutorial on Nick Gammon's forum, if you haven't already. This shows how to use the hardware timers for timing and counting pulses. By comparison of Nick's timer/counter/pin diagrams and the documentation for the Servo library, I conclude that the servo library probably uses Timer1.
Thanks peter for the info. But can you follow that up by putting it & testing it a little bit in the first pair of sketches I sent? I would be a great help for me? Thanks in adv.
If can I use the tilt value from the processing app to change set an analog PIN of arduino with analoWrite() for the corresponding tilt value coming over serial & connect that analog pin to another arduino's Same/Another Analog PIN. Then use the analogRead() to read the value coming over that PIN & set position of servo according to the value. Can it be done. I can use an ATtiny in that case to drive the servo separate. This way it won't have to be dependent on the RADAR-ARDUINO's timers.
dattasaurabh82:
If can I use the tilt value from the processing app to change set an analog PIN of arduino with analoWrite() for the corresponding tilt value coming over serial & connect that analog pin to another arduino's Same/Another Analog PIN. Then use the analogRead() to read the value coming over that PIN & set position of servo according to the value. Can it be done. I can use an ATtiny in that case to drive the servo separate. This way it won't have to be dependent on the RADAR-ARDUINO's timers.
That is a bizarre solution. Setting aside your reasons for wanting to use two Arduinos, which I don't follow and am not convinced make sense, an analog DC signal is not a good solution for two Arduinos to communicate especially when neither of then has DAC capability. There are plenty of digital communications methods available to you.
Yes, or SoftwareSerial - that's still not a complete list. The best solution depends on the range and data rate you need to achieve, but since it seems the two processors will be right next to each other then I think you will have a pretty free choice. SoftwareSerial would probably be the easiest to use.