前提・実現したいこと
Arduino UnoでGPSの計測をおこなっていたのですが、Arduino Dueに変えたところSoftwaresirialが使えないためプログラムを変更したのですがエラーが出てしまいます。実現したいことといたしましては、シリアルにGPSの値を表示したいです。
よろしくお願いします。ちなみにGPSは18、19ピンを利用しています。
発生している問題・エラーメッセージ
In function 'void loop()': fix.Serial:102:19: error: request for member 'available' in '(0, 19)', which is of non-class type 'int' while (mySerial.available()>0) { ^ fix.Serial:103:23: error: request for member 'read' in '(0, 19)', which is of non-class type 'int' char c = mySerial.read(); exit status 1 request for member 'available' in '(0, 19)', which is of non-class type 'int'
該当のソースコード
C言語
1#include <fifo.h> 2#include <soft_uart.h> 3#include <TinyGPS++.h> 4 5#define mySerial (18,19) 6Serial.begin(9600); 7 8while (!Serial) { 9 ; // wait for serial port to connect. Needed for native USB port only 10 } 11 12 Serial.println("GPS START!"); 13 14void loop(){ 15 16 while (mySerial.available()>0) { //データが存在する間はループする 17 char c = mySerial.read(); 18 Serial.print(c); 19 gps.encode(c); 20 //Serial.println(Serial1.read()); 21 if (gps.location.isUpdated()) { //もしGPSが正常に更新されていたら...⬇ 22 gps_flg = 1; 23 LAT_GPS = gps.location.lat(); 24 LONG_GPS = gps.location.lng(); 25 Serial.print("LAT="); Serial.println(LAT_GPS, 6); 26 Serial.print("LONG="); Serial.println(LONG_GPS, 6); 27}
試したこと
いろいろプログラムを書き直しました。
補足情報(FW/ツールのバージョンなど)
Arduino Due
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/10/31 04:58
2018/10/31 05:02
2018/10/31 05:05
2018/10/31 05:09
2018/10/31 06:15
2018/10/31 06:28
2018/10/31 07:35
2018/10/31 11:05