Because I wish to do an enhancement of my project. I've been tracking each color pin of the FTDI but I could not really understand how to do this, if possible..
Another question..
Is there any pin that I can toggle on 5v(or 3.3v) or 0v? example to on and off a led which is connected to the plane.
If yes, I am thinking of sending a certain character to ardupilot using Xbee and a certain program will check if the character matches, then the led on the plane will be turned on..
Last question..
I wrote a short program that is trying to read the data coming from C#, which is almost the same what I will be doing in the previous question..
int incomingByte = 0; // for incoming serial data
#define AIRSPEED_SENSOR 1
long analog0 = 511; // Thermopiles
long analog1 = 511; // Thermopiles
long analog2 = 511; // Thermopiles
void setup() {
Serial.begin(57600); // opens serial port, sets data rate to 9600 bps
}
void loop() {
analog0 = analogRead(0);
analog1 = analogRead(1);
analog2 = analogRead(2);
if (Serial.available() > 0) {
incomingByte = Serial.read();
if ( incomingByte == 49 ) // 49 is ASCII for 1
{
Serial.println("Auto pilot mode activated");
//some more program here//
}
while ( incomingByte == 50 && Serial.available () == 0) // 49 is ASCII for 1
{
analog0 = analogRead(0);
analog1 = analogRead(1);
analog2 = analogRead(2);
Serial.print("X sensor: ");
Serial.print(analog0);
Serial.print(", Y sensor: ");
Serial.print(analog1);
Serial.print(", Z sensor: ");
Serial.println(analog2);
delay(200);
}
else
{
Serial.print("Unknown Byte");
}
}
}
the above program will be basically check if 1 s read, if yes, some autopilot program will be executed.. if 2 is read, the ardupilot will return the XYZ sensor values accordingly..
is the program reliable?
Thanks..
Darren here~
You need to be a member of diydrones to add comments!
Replies