Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf83dd75

Browse files
committed
Added files that were lost
1 parent9677314 commitf83dd75

File tree

2 files changed

+127
-0
lines changed

2 files changed

+127
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
//
2+
// Copyright 2015 Google Inc.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//
16+
17+
18+
// A sample that will start our serial transciever listening on a software
19+
// port and allow debug over the main serial port.
20+
//
21+
// A suggested setup for testing this example would be to connect a board
22+
// with integrated usb and open a serial monitor to see debug messages.
23+
// Then connect another board on pin4 and pin5 to communicate over serial.
24+
25+
#include<SoftwareSerial.h>
26+
#include<ESP8266WiFi.h>
27+
28+
#include<Firebase.h>
29+
#include<SerialTransceiver.h>
30+
31+
// Set these to run example.
32+
#defineWIFI_SSID"SSID"
33+
#defineWIFI_PASSWORD"PASSWORD"
34+
35+
SoftwareSerialdata_serial(5/*RX*/,4/*TX*/);
36+
firebase::modem::SerialTransceiver transceiver;
37+
38+
voidsetup() {
39+
Serial.begin(9600);
40+
41+
// connect to wifi.
42+
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
43+
Serial.print("connecting");
44+
while (WiFi.status() != WL_CONNECTED) {
45+
Serial.print(".");
46+
delay(500);
47+
}
48+
Serial.println();
49+
Serial.print("connected:");
50+
Serial.println(WiFi.localIP());
51+
52+
data_serial.begin(9600);
53+
while (!data_serial) {
54+
Serial.println("Error initilizing serial.");
55+
delay(5000);
56+
}
57+
58+
transceiver.begin(&data_serial);
59+
}
60+
61+
voidloop() {
62+
transceiver.loop();
63+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
//
2+
// Copyright 2015 Google Inc.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//
16+
17+
18+
// A sample that will start our serial transciever listening on the primary
19+
// Serial port.
20+
//
21+
// A suggested setup for testing this example would be a esp8266 with built
22+
// in usb connected.
23+
// First edit begin.txt and put in your host and secret.
24+
// Then run the following commands to setup the serial port (assuming ttyUSB0)
25+
// in linux:
26+
// stty -F /dev/ttyUSB0 9600 raw -echo -echoe -echok
27+
// Then on one console do:
28+
// cat /dev/ttyUSB0 &
29+
// This console will now read all responses from the modem. Then do:
30+
// cat begin.txt > /dev/ttyUSB0
31+
// You should see +OK and you can now feed in the other example commmands.
32+
33+
#include<SoftwareSerial.h>
34+
#include<ESP8266WiFi.h>
35+
36+
#include<Firebase.h>
37+
#include<SerialTransceiver.h>
38+
39+
// Set these to run example.
40+
#defineWIFI_SSID"SSID"
41+
#defineWIFI_PASSWORD"PASSWORD"
42+
43+
firebase::modem::SerialTransceiver transceiver;
44+
45+
voidsetup() {
46+
Serial.begin(9600);
47+
48+
// connect to wifi.
49+
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
50+
Serial.print("connecting");
51+
while (WiFi.status() != WL_CONNECTED) {
52+
Serial.print(".");
53+
delay(500);
54+
}
55+
Serial.println();
56+
Serial.print("connected:");
57+
Serial.println(WiFi.localIP());
58+
59+
transceiver.begin(&Serial);
60+
}
61+
62+
voidloop() {
63+
transceiver.loop();
64+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp