Hello.
I've been strugling to make topic thing to happen. I have GPS speed at serial monitor. I don't understand how to use currentFix feature. Compile stops to error: invalid use of non-static member function outputValue = map(currentFix.speed_kph, 1, 3, 50, 250);
If I did understand "instructions" correctly, I should be able to use speed value anywhere in the code when currentFix is used?
I can't swing gps antenna enough fast so that's why mapping values are so low
I've been strugling to make topic thing to happen. I have GPS speed at serial monitor. I don't understand how to use currentFix feature. Compile stops to error: invalid use of non-static member function outputValue = map(currentFix.speed_kph, 1, 3, 50, 250);
If I did understand "instructions" correctly, I should be able to use speed value anywhere in the code when currentFix is used?
Code:
#include <NMEAGPS.h>
#include <GPSport.h>
NMEAGPS gps; // This parses the GPS characters
gps_fix currentFix; // This holds on to the latest values
int viisari = 6;
int outputValue = 0;
void setup()
{
Serial.begin(115200);
Serial.print( F("NMEAsimple.INO: started\n") );
gpsPort.begin(9600);
pinMode(viisari, OUTPUT);
}
//--------------------------
void loop()
{
while (gps.available( gpsPort )) {
currentFix = gps.read();
Serial.println( F("Speed: ") );
if (currentFix.valid.speed)
Serial.println( currentFix.speed_kph(), 1 );
outputValue = map(currentFix.speed_kph, 1, 3, 50, 250);
analogWrite(viisari, outputValue);
Serial.println(outputValue);
}
}
I can't swing gps antenna enough fast so that's why mapping values are so low