0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GPSの研究 その23

Posted at

概要

GPSを理解したかった。
wemos D1でGPSロガー作って見た。

写真

CIMG2660.JPG

回路図

gps.JPG

サンプルコード

# include <SPI.h>
# include <SD.h>
# include <SoftwareSerial.h>

SoftwareSerial ss(5, 4, false, 256);
const int chipSelect = 2;
void setup()
{
	Serial.begin(9600);
	ss.begin(9600);
	while (!Serial)
	{
		;
	}
	Serial.println("\nBegin sdcard");
	if (!SD.begin(chipSelect))
	{
		Serial.println("Card failed, or not present");
		return;
	}
	Serial.println("sdcard initialized");
}
void loop()
{
	String response = "";
	File dataFile = SD.open("datalog.txt", FILE_WRITE);
	if (dataFile)
	{
		while (ss.available() > 0)
		{
			char c = ss.read();
			response += c;
		}
		dataFile.print(response);
		dataFile.close();
	}
	else
	{
		Serial.println("error opening datalog.txt");
	}
}



以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?