lauchpad cc3200 điều khiển thiết bị qua wifi - control devices with Lauchpad cc3200 over wifi, LAN
Ví dụ dưới đây cho phép chúng ta điều khiển thiết bị điện thông qua mạng wifi/LAN một cách đơn giản. #ifndef __CC3200R1M1RGC__ // Do not include SPI for CC3200 LaunchPad #include <SPI.h> #endif #include <WiFi.h> // your network name also called SSID char ssid[] = "tên wifi"; // your network password char password[] = "password wifi"; // your network key Index number (needed only for WEP) int keyIndex = 0; int aa = 0; WiFiServer server(80); const int buttonPin = PUSH2; const int buttonPin1 = PUSH1; int buttonState = 0; int buttonState1 = 0; void setup() { Serial.begin(115200); // initialize serial communication pinMode(RED_LED, OUTPUT); // set the LED pin mode pinMode(10, OUTPUT); pinMode(buttonPin, INPUT_PULLUP); pinMode(buttonPin1, INPUT_PULLUP); // attempt to connect to Wifi network: Serial.print("Attempting to connect to Network named: "); // print the network name (SSID); Serial.println