Newbie prob

Hi I’ new here. For tinkering I run Processing 1.5.1 and Arduino 1.0. I’m trying to test some bunches of code but I think I do some very basics wrong…
For example: When I load GPS_MTK_test.pde which is

// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-
/*
	Example of GPS MTK library.
	Code by Jordi Munoz and Jose Julio. DIYDrones.com

	Works with Ardupilot Mega Hardware (GPS on Serial Port1)
*/
#include <FastSerial.h>
#include <AP_Common.h>
#include <AP_GPS.h>

FastSerialPort0(Serial);
FastSerialPort1(Serial1);

AP_GPS_MTK gps(&Serial1);
#define T6 1000000
#define T7 10000000

void setup()
{
    Serial.begin(38400);
    Serial1.begin(38400);
    stderr = stdout;
    gps.print_errors = true;

    Serial.println("GPS MTK library test");
    gps.init();	 // GPS Initialization
    delay(1000);
}
void loop()
{
    delay(20);
    gps.update();
    if (gps.new_data) {
        Serial.print("gps:");
        Serial.print(" Lat:");
        Serial.print((float)gps.latitude / T7, DEC);
        Serial.print(" Lon:");
        Serial.print((float)gps.longitude / T7, DEC);
        Serial.print(" Alt:");
        Serial.print((float)gps.altitude / 100.0, DEC);
        Serial.print(" GSP:");
        Serial.print(gps.ground_speed / 100.0);
        Serial.print(" COG:");
        Serial.print(gps.ground_course / 100.0, DEC);
        Serial.print(" SAT:");
        Serial.print(gps.num_sats, DEC);
        Serial.print(" FIX:");
        Serial.print(gps.fix, DEC);
        Serial.print(" TIM:");
        Serial.print(gps.time, DEC);
        Serial.println();
        gps.new_data = 0; // We have readed the data
    }
}

I get some errors:
processing.app.SketchException: unexpected char ‘i’
at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:353)
at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:197)
and many more

I asked google but haven’t found an satisfieing answer to the prob. Does this unexpected char ‘i’ error thing come from outside of the code or something?

After that I loaded the same file GPS_MTK_test.pde to the Arduino IDE. Do I have to worry about the .pde extension here? Anyway, I get:
AP_Math.h: No such file or directory

Hmm. But this very AP_Math.h is in
C:\AVR\Arduino_stuff\arduino-1.0-windows\arduino-1.0\libraries\AP_Math
So I think the location is right.

What’s going on here?

For example: When I load GPS_MTK_test.pde which is

Arduino sketch files with 1.0 have the extension .ino. All libraries that come with examples for Arduino 1.0 use the .ino extension.

Where did you get this non-1.0 compatible sketch?

I get some errors: processing.app.SketchException: unexpected char 'i' at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:353) at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:197) and many more

That's an Arduino sketch. It would be very surprising if Processing did compile it.

Hi, thanks for your response. This code is from the ardupilot project. So you think when it is not with .ino extension then it's not an Arduino project at all...? Well, all files of the ardupilot project come with either .h, .cpp or .pde. You are right. I looked on the processing IDE and haven't found an upload button... But why is the extension as it is?

The Arduino IDE was based on the Processing one. The pde extension came from Processing, and was also used by the pre-1.0 Arduino IDE. The extension was changed for the 1.0 IDE to remove the confusion.

It's quite possible that the Ardupilot sketches haven't been updated for IDE 1.0 and are still using the pde extension.

AP_Math.h: No such file or directory

Solved it. After adding:

#include <AP_Math.h>

to that, it was compilable.

#include <FastSerial.h>
#include <AP_Common.h>
#include <AP_GPS.h>

I don’t have the slightest clue why this brilliant nerd who developed the code omited that line…