-
Notifications
You must be signed in to change notification settings - Fork 2
Quick Start Guide for SAM D21
-
You will need an Atmel SAM D21 Xplained Pro board, an Atmel ATWINC1500 XPRO board, a micro-USB cable, a computer running Windows, and Atmel Studio.
-
Download the Atmel Studio< http://www.atmel.com/tools/ATMELSTUDIO.aspx > and install it.
-
Connect the WINC1500 board to the EXT1 of the D21.
-
Connect the DEBUG USB of the D21 board to Windows PC.
-
Open samd21\samples\quick_start\quick_start.atsln file. For your information, the firmware version of the WINC1500 should be 19.2.1. Please refer to this link.
-
In main.c file, at beginning of the main() function, change the following three lines to configure your WiFi.
char ssid[] = "YOUR_NETWORK_ID";
char pw[] = "YOUR_NETWORK_PASS";
// 0 - no security, 1 - WEP, 2 - WPA
int secType = 2;
- Paste the following line and edit the parseInitialize function In the main() function.
parseClient = parseInitialize(“YourApplicationId”, “YourClientId”);
-
Build and upload the project to the D21 board.
-
After uploading successfully, choose ‘Start Without Debugging (Ctrl+Alt+F5)’.
#Save an Object
Copy and paste the following parseSendRequest function after the parseInitialize.
parseSendRequest(parseClient, "POST", "/1/classes/TestObject", "{\"foo\":\"bar\"}", requestCallback);
Build, upload and run your project. A new object of class TestObject will be sent to the Parse Clould and saved.
#Send Push Notifications
Add the following lines instead of parseSendRequest function in the main function.
parseSetInstallationId(parseClient, "YourInstallationId");
parseSetPushCallback(parseClient, pushCallback);
parseStartPushService(parseClient);
while(1){
parseRunPushLoop(parseClient);
}
Add pushCallback function somewhere else in the main.c file. When you receive a push message, the pushCallback will be called.
void pushCallback(ParseClient client, int error, const char* data)
{
if (0 != error) {
printf("pushCallback / error code %d / Error !!!!!\r\n", error);
return;
}
printf("pushCallback : 0x%x, %s\r\n", client, data);
}
Build, upload and run your project. If you send a push on Parse web, the D21 will get the message.