Skip to content

Instantly share code, notes, and snippets.

@TakehikoShimojima
Last active April 15, 2018 04:24
Show Gist options
  • Select an option

  • Save TakehikoShimojima/24348b14a6680e61d599b4e9e011578b to your computer and use it in GitHub Desktop.

Select an option

Save TakehikoShimojima/24348b14a6680e61d599b4e9e011578b to your computer and use it in GitHub Desktop.
#include <ESP8266WiFi.h>
#include <SoftwareSerial.h>
static const int RXPin = 2, TXPin = 12; // ソフトシリアルのピンの指定
SoftwareSerial ss(RXPin, TXPin, false, 256); // ソフトシリアルのオブジェクト
void setup()
{
Serial.begin(115200);
delay(20);
Serial.println("\r\nGPS test");
ss.begin(9600); // ソフトシリアルの初期化
}
void loop()
{
while (ss.available() > 0) { // ソフトシリアルに文字があるあいだ
Serial.write(ss.read()); // ソフトシリアルから読んで、普通のシリアルにコピーする
delay(0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment