PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Network
WiFi
Join a Network.c
1
/*
2
Join a Network.c
3
4
Make sure to update the SSID and passphrase parameters in the
5
wifi_join call before running.
6
7
Application circuit:
8
DO -> P9, DI <- P8, SEL - GND. Use USB cable and the
9
USB COM port for loading code and debugging.
10
11
Note: This example relies on the 0.8 version of the wifi library.
12
Updates may change some function behaviors in later releases.
13
*/
14
15
#include "
simpletools.h
"
16
#include "
wifi.h
"
17
18
int
main
()
19
{
20
wifi_start
(9, 8, 115200,
USB_PGM_TERM
);
21
22
print
(
"Join a network:\r"
);
23
wifi_join
(
"SSID"
,
"passphrase"
);
24
25
int
ip[] = {0, 0, 0, 0};
26
memset(ip, 0, 16);
27
do
28
{
29
wifi_ip
(
STA
, ip);
30
}
while
(ip[0] == 0 && ip[1] == 0 && ip[2] == 0 && ip[3] == 0);
31
print
(
"\rip=%d.%d.%d.%d\r"
, ip[0], ip[1], ip[2], ip[3]);
32
33
int
mode =
wifi_mode
(
CHECK
);
34
switch
(mode)
35
{
36
case
STA
:
//0xf4:
37
print
(
"mode=STA\r"
);
38
break
;
39
case
AP
:
//0xf3
40
print
(
"mode=AP\r"
);
41
break
;
42
case
STA_AP
:
//0xf2
43
print
(
"mode=STA+AP"
);
44
break
;
45
}
46
}
wifi.h
API for the Parallax WX Wi-Fi Module ESP8266-WROOM-02 (Part #32420). This library has a preliminary A...
wifi_start
fdserial * wifi_start(int fromDO, int toDI, int baud, int comSelect)
Set up Wi-Fi module serial connections for data command and transparent data communication.
Definition:
wifi.c:47
STA
#define STA
Token used for both setting up and indicating station mode. In this mode, the Wi-Fi module is a stati...
Definition:
wifi.h:314
wifi_mode
int wifi_mode(int mode)
Set or check the Wi-Fi module's network mode.
Definition:
mode.c:48
CHECK
#define CHECK
Command token used to check a Wi-Fi module setting or I/O pin state.
Definition:
wifi.h:168
STA_AP
#define STA_AP
Token used for both setting up and indicating station plus access point mode. This mode should only b...
Definition:
wifi.h:327
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
wifi_join
int wifi_join(char *network, char *password)
Attempt to join a network via the ssid access point using passphrase.
Definition:
join.c:48
print
int print(const char *format,...) __attribute__((format(printf
Print format "..." args to the default simple terminal device. The output is limited to 256 bytes.
USB_PGM_TERM
#define USB_PGM_TERM
Definition:
wifi.h:114
AP
#define AP
Token that can be used for both setting up and checking the Wi-Fi module's access point mode....
Definition:
wifi.h:259
main
int main(void)
Definition:
GraphicsTest.c:20
wifi_ip
int wifi_ip(int mode, int *ipAddr)
Check the IP address for the Parallax Wi-Fi module.
Definition:
ipaddr.c:48
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17