|
|
# Ausgangslage
|
|
|
* UART WiFi Modul
|
|
|
* Baud Rate: 115200
|
|
|
* Based on ESP8266 ESP-06 SoC
|
|
|
* AT Firmware: esp_iot_sdk_v1.1.0 + Seeed modifications:
|
|
|
* 2x additional AT commands to control blue Link LED.
|
|
|
* [AT command set](https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf)
|
|
|
* +19.5dBm output power in 802.11b
|
|
|
|
|
|
# Bedingungen
|
|
|
* Scoring
|
|
|
* Spielresultate auf Datenbank persistieren
|
|
|
|
|
|
# Aufbau
|
|
|
* [Seeeduino V4.2](http://wiki.seeed.cc/Seeeduino_v4.2)
|
|
|
* als [**Arduino UNO**](https://www.arduino.cc/en/Main/Software) programmieren
|
|
|
* Input
|
|
|
* [Wii Nunchuck](http://wiki.seeed.cc/Grove-NunChuck) - <code>I2C</code>
|
|
|
* Output
|
|
|
* Serial Monitor <code>UART</code>
|
|
|
* [Led](http://wiki.seeed.cc/Grove-LED_Socket_Kit/) - <code>D8</code>
|
|
|
* Input/Output
|
|
|
* [Grove - UART Wi-Fi](http://wiki.seeed.cc/Grove-UART_Wifi/) - <code>UART: 2=Rx, 3=Tx</code>
|
|
|
|
|
|
# Handlungsziele
|
|
|
|
|
|
|Vorgehen|Hannok [Handlungsnotwendige Kenntnisse](https://cf.ict-berufsbildung.ch/modules.php?name=Mbk&a=20101&cmodnr=242&noheader=1)|
|
|
|
|:-------|:------|
|
|
|
|Kommunikation | UART |
|
|
|
|Input/Output| AT Command SET |
|
|
|
|sinnvolle Datentypen | CHAR |
|
|
|
|Testbarkeit | Loggen, UART |
|
|
|
|
|
|
# Code Sample
|
|
|
|
|
|
[**ESP8266 AT Instruction Set**](https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf)
|
|
|
|
|
|
```c
|
|
|
#include <SoftwareSerial.h>
|
|
|
|
|
|
/* Use Serial Monitor with AT COMMAND SET as Input, e.g:
|
|
|
|
|
|
AT
|
|
|
AT+LEDON
|
|
|
AT+LEDOFF
|
|
|
|
|
|
more Infos: SP8266 AT Instruction Set
|
|
|
*/
|
|
|
|
|
|
#define DELAY 20
|
|
|
#define BAUD_RATE_MONITOR 9600
|
|
|
#define BAUD_RATE_WIFI 115200
|
|
|
|
|
|
SoftwareSerial WiFi(2, 3); // Rx, Tx
|
|
|
|
|
|
void setup() {
|
|
|
Serial.begin(BAUD_RATE_MONITOR);
|
|
|
while (!Serial); // wait for monitor UART
|
|
|
WiFi.begin(BAUD_RATE_WIFI);
|
|
|
while (!WiFi); // wait for WiFi UART
|
|
|
Serial.println("Ready - Input AT Commands on Serial Monitor\n");
|
|
|
}
|
|
|
|
|
|
void loop() {
|
|
|
if (Serial.available()) WiFi.write(Serial.read());
|
|
|
delay(DELAY);
|
|
|
if (WiFi.available()) Serial.write(WiFi.read());
|
|
|
delay(DELAY);
|
|
|
}
|
|
|
``` |