Hi
I am trying to read my distance sensor using arduino from my IMU board. I have connected my sonar in the pitot tube port and I have writtten code to read from the sensor. However i do not know which pin I should use to read.
Anyone that can help me would be great.
Tags:
Maybe the "expansion ports" on the blue board? Otherwise, I would think the 3-pin headers should have Vcc and GND (standard servo pinout)
Permalink Reply by Dany Rassam on January 31, 2012 at 7:05pm Thanks for your help. Im going to go and solder my header pins onto the expansion ports and hopefully it will work. I will plug it into AN6. Just to confirm, this is the code I will be using:
int A6;
long anVolt, cm;
void setup()
{
Serial.begin(9600);
}
void loop()
{
pinMode(A6, INPUT);
anVolt = analogRead(A6);
cm = anVolt/1024;
Serial.print(cm);
Serial.print("cm");
Serial.println();
delay(500);
}
is using A6 ok or should I use ADC6 or something different altogether?
According to this: http://arduino.cc/en/Tutorial/AnalogInputPins
You should remove the line "int A6;"
Because that sets up a variable A6 that will have initial value 0, so the pinMode() and analogRead() calls will attempt to operate on analog pin 0. A6, however, is an alias for analog pin 6. Or you could use 6.
Permalink Reply by Dany Rassam on January 31, 2012 at 8:16pm Thanks alot!!!!!! It worked finally. Lifesaver is what you are
In the industrial workplace I work with 0 to 10 Volts DC or a 4 to 20 ma Loop. A 4 to 20 ma loop seeks. A 0 to 10 volt references to the voltage. Understand the power to reference might be different. Personally I like a power loop. The I2C has very high Impedance and is subject to adjacent RFI and EMI interference.
Such is defining inputs according to architecture. If it is analog then scale accordingly.
Season Two of the Trust Time Trial (T3) Contest has now begun. The third round was a reliablilty/aerial photography round for both planes and copters, which is now closed. Stay tuned for the next round, beginning soon.29 members
60 members
19 members
114 members
94 members
© 2012 Created by Chris Anderson.
