Closed
Description
Using the Wifi scan network example:
/*
This example prints the board's MAC address, and
scans for available WiFi networks using the GIGA R1 WiFi board.
Every ten seconds, it scans again. It doesn't actually
connect to any network, so no encryption scheme is specified.
Circuit:
* GIGA R1 WiFi
created 13 July 2010
by dlf (Metodo2 srl)
modified 21 June 2012
by Tom Igoe and Jaymes Dec
modified 3 March 2023
by Karl Söderby
*/
#include <SPI.h>
#include <WiFi.h>
void printMacAddress(byte mac[]);
void listNetworks();
void printMacAddress(byte mac[]);
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// check for the WiFi module:
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
}
// print your MAC address:
byte mac[6];
WiFi.macAddress(mac);
Serial.print("MAC: ");
printMacAddress(mac);
}
void loop() {
// scan for existing networks:
Serial.println("Scanning available networks...");
listNetworks();
delay(10000);
}
void listNetworks() {
// scan for nearby networks:
Serial.println("** Scan Networks **");
int numSsid = WiFi.scanNetworks();
if (numSsid == -1) {
Serial.println("Couldn't get a WiFi connection");
while (true);
}
// print the list of networks seen:
Serial.print("number of available networks:");
Serial.println(numSsid);
// print the network number and name for each network found:
for (int thisNet = 0; thisNet < numSsid; thisNet++) {
Serial.print(thisNet);
Serial.print(") ");
Serial.print(WiFi.SSID(thisNet));
Serial.print("\tSignal: ");
Serial.print(WiFi.RSSI(thisNet));
Serial.print(" dBm");
Serial.print("\tEncryption: ");
printEncryptionType(WiFi.encryptionType(thisNet));
}
}
void printEncryptionType(int thisType) {
// read the encryption type and print out the name:
switch (thisType) {
case ENC_TYPE_WEP:
Serial.println("WEP");
break;
case ENC_TYPE_TKIP:
Serial.println("WPA");
break;
case ENC_TYPE_CCMP:
Serial.println("WPA2");
break;
case ENC_TYPE_NONE:
Serial.println("None");
break;
case ENC_TYPE_AUTO:
Serial.println("Auto");
break;
case ENC_TYPE_UNKNOWN:
default:
Serial.println("Unknown");
break;
}
}
void printMacAddress(byte mac[]) {
for (int i = 5; i >= 0; i--) {
if (mac[i] < 16) {
Serial.print("0");
}
Serial.print(mac[i], HEX);
if (i > 0) {
Serial.print(":");
}
}
Serial.println();
}
Ran into issues on initial run.
- llext_exports.c - several symbols were not defined so added the following:
EXPORT_SYMBOL(atoi);
EXPORT_SYMBOL(islower);
EXPORT_SYMBOL(memcpy);
EXPORT_SYMBOL(memset);
EXPORT_SYMBOL(strtok);
EXPORT_SYMBOL(strtol);
- Keep having to put giga into boot mode to load the sketch.
Once they were added and recompiled core received following error::
�[m
�[1;32muart:~$ �[msketch
[00:00:13.562,000] �[1;33m<wrn> usb_device: USB device support already enabled�[0m
Communication with WiFi module failed!
then realized the PR does not setup wifi for the giga.
More can be found here: #17 (comment)
Metadata
Metadata
Assignees
Labels
No labels