Code Examples
CYW943907AEVAL1F Evaluation Kit User Guide, Doc. No. 002-18703 Rev. *B
47
Figure 5-10. Endpoint
13.
Navigate to the
publish_subscribe.c
file to update the
MQTT_BROKER_ADDRESS
macro with the endpoint address copied
from
HTTPS
tab.
Remove the first string before “.” in endpoint and replace it with * and copy it to the
REGION
macro. In
this case, it is
*.iot.ap-southeast-1.amazonaws.com
.
14.
The created Thing, policy, and certificate are used to interact with the AWS IoT.
5.1.3.5 Access Point Credentials
Enter your credentials (SSID and pass phrase key) in the
wifi_config_dct.h
file. The
CLIENT_AP_SSID
macro should be
updated with your access point’s SSID, the
CLIENT_AP_PASSPHRASE
macro should be updated with your access point’s
pass phrase key and the
CLIENT_AP_SECURITY
macro should be updated with the security type of your access point. This
is
WICED_SECURITY_WPA2_MIXED_PSK
if your access point uses WPA2-PSK. If your AP uses a different security, then
choose the correct one defined in
enum wiced_security_t
from
AWSIOTPubSub_bootloader_Base_WICED/wiced_base-1.0/components/WIFI-
SDK/WICED/WWD/include/wwd_constants.h
5.1.3.6 Build, Program, and Verify
Your Wi-Fi access point must be connected to the internet to verify the example. Build and program the
publish_subscribe_aws example using a similar procedure to the one provided in
Building, Programming, and Debugging
After it has been programmed, the CYW943907AEVAL1F EVK will try to connect to AWS IoT and subscribe to the specified
topic. After that, if you press switch USER_1, it will turn LED_1 ON and OFF alternately as shown in
. Note that
this is being done over the cloud. That is, pushing the switch publishes a message to the cloud. The LED turns ON in response
to a notification from the cloud. You can also observe the messages inside the AWS console. In the AWS IoT console window,
go to
Monitor
>
Messages published
to
see the number of messages exchanged as shown in