Last active
November 7, 2017 06:26
-
-
Save KazuyukiEguchi/fe24bbbc9341f286929969aac07aae45 to your computer and use it in GitHub Desktop.
Wio LTEでSMSを受信してみる(mineo au SIM) ref: http://qiita.com/KazuyukiEguchi/items/2f6ca6e329ce1e98a646
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <WioLTEforArduino.h> | |
#include <limits.h> | |
#include <stdio.h> | |
WioLTE Wio; | |
void setup() { | |
// put your setup code here, to run once: | |
delay(200); | |
SerialUSB.println(""); | |
SerialUSB.println("--- START ---------------------------------------------------"); | |
SerialUSB.println("### I/O Initialize."); | |
Wio.Init(); | |
SerialUSB.println("### Power supply ON."); | |
Wio.PowerSupplyLTE(true); | |
delay(5000); | |
SerialUSB.println("### Turn on or reset."); | |
if (!Wio.TurnOnOrReset()) { | |
SerialUSB.println("### ERROR! ###"); | |
return; | |
} | |
delay(3000); | |
if(Wio.Activate("mineo.jp","[email protected]","mineo") == true) { | |
SerialUSB.println("Activate is True"); | |
} else { | |
SerialUSB.println("Activate is False"); | |
} | |
delay(3000); | |
SerialUSB.println("Loop Start"); | |
} | |
void loop() { | |
char num[20]; | |
if(Wio.GetPhoneNumber(num,sizeof(num)) > 0) { | |
SerialUSB.println(num); | |
} | |
int rssi = Wio.GetReceivedSignalStrength(); | |
if (rssi == INT_MIN) { | |
SerialUSB.println("### ERROR! ###"); | |
goto err; | |
} | |
SerialUSB.print("RSSI:"); | |
SerialUSB.print(rssi); | |
SerialUSB.println(""); | |
char mes[256]; | |
if(Wio.ReceiveSMS(mes,sizeof(mes)) > 0) | |
{ | |
SerialUSB.print("SMS:"); | |
SerialUSB.println(mes); | |
Wio.DeleteReceivedSMS(); | |
} | |
err: | |
delay(5000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment