Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 7:ae30afe76643, committed 2015-01-07
- Comitter:
- dmjanke
- Date:
- Wed Jan 07 20:42:00 2015 +0000
- Parent:
- 6:2ccd786cadd0
- Commit message:
- Clean up.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Nov 24 22:40:35 2014 +0000
+++ b/main.cpp Wed Jan 07 20:42:00 2015 +0000
@@ -2,18 +2,15 @@
#include "mbed.h"
#include "mtsas.h"
+//Phone number to send to and receive from. Must be in the form "1xxxxxxxxxx"
+string PHONE_NUMBER = "CHANGE ME PLEASE";
+
DigitalOut heater(A1);
AnalogIn sensor(A0);
DigitalIn button(D5);
int main(void)
-{
- //Modify to match your apn if you are using an HSPA radio with a SIM card
- const char APN[] = "[CHANGE ME]";
-
- //Phone number to send to and receive from. Must be in the form "1xxxxxxxxxx"
- string PHONE_NUMBER = "[CHANGE ME]";
-
+{
printf("Breathalizer Starting ...\n\r");
//Sets the log level to INFO, higher log levels produce more log output.
@@ -22,8 +19,14 @@
Cellular::Sms txtmsg;
txtmsg.phoneNumber = PHONE_NUMBER;
- txtmsg.message = "HeyBoss, just sending SMS messages with my MTSAS. No Biggie.-Max";
+ if(PHONE_NUMBER == "CHANGE ME PLEASE") {
+ while(1) {
+ printf("FORGOT TO SET THE PHONE NUMBER\r\n");
+ wait(1.0f);
+ }
+ }
+
/** STMicro Nucelo F401RE
* The supported jumper configurations of the MTSAS do not line up with
* the pin mapping of the Nucleo F401RE. Therefore, the MTSAS serial TX
@@ -45,25 +48,6 @@
return 1;
}
- //Commenting out next line. D4, D7, or RESET may be overlapping A0 Sensor Input
- //radio->configureSignals(D4,D7,RESET);
-
- Transport::setTransport(radio);
-
- //Set radio APN
- printf("Setting APN [%s]\r\n", APN);
- for (int i = 0; i < 10; i++) {
- if (i >= 10) {
- logError("Failed to set APN\n");
- }
- if (radio->setApn(APN) == MTS_SUCCESS) {
- logInfo("Successfully set APN\n");
- break;
- } else {
- wait(1);
- }
- }
-
float value = 0.0f;
heater = 0; //Active Low, 0 is turning it on.
wait(0.1f);
@@ -72,7 +56,7 @@
while(value > 0.001f) {
wait(1.0f);
value = 1.0f - sensor;
- printf("Sensor is: %2.2f\r\n", value);
+ printf("Sensor is warming up : %2.2f\r\n", value);
}
printf("Sensor is warmed up!!! :-) \r\n");
@@ -107,10 +91,10 @@
// Send SMS message to phone
for (int i = 1; i < 10; i++) {
if(radio->sendSMS(txtmsg) == MTS_SUCCESS) {
- logInfo("Sent SMS successfully:<%s>\n", txtmsg.message.c_str());
+ logInfo("Sent SMS successfully: <%s>\n", txtmsg.message.c_str());
break;
} else {
- logError("Failed to send SMS<%s>\n", txtmsg.message.c_str());
+ logError("Failed to send SMS: <%s>\n", txtmsg.message.c_str());
}
}
}