To connect your LionBit development board to a Wi-Fi network, you can use the built-in Wi-Fi capabilities provided by the ESP32 microcontroller. Here’s a sample code to connect LionBit to a Wi-Fi network using the Arduino IDE:
#include <LionBit.h>
#include <WiFi.h>
const char* ssid = "Your_WiFi_SSID"; // Replace with your Wi-Fi network name
const char* password = "Your_WiFi_Password"; // Replace with your Wi-Fi password
void setup() {
LionBit.begin();
// Connect to Wi-Fi
Serial.begin(115200);
delay(10);
// Connect to Wi-Fi network
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("Connected to Wi-Fi");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {
// Your main program logic goes here
}
In this code, replace "Your_WiFi_SSID"
and "Your_WiFi_Password"
with your actual Wi-Fi network name (SSID) and password. When you upload this code to your LionBit, it will connect to the specified Wi-Fi network.
The sample code initializes a Wi-Fi connection and waits until the LionBit successfully connects to the network. You can then proceed with your project logic, such as sending and receiving data over Wi-Fi, interacting with IoT cloud platforms, or accessing web services.