Permalink
Browse files

Adding beginning of Ibelium interface

  • Loading branch information...
1 parent 240f5c1 commit 62b6cf1fa119b33fcd60a3aae94d5e525402938e @rkevingibson rkevingibson committed Feb 7, 2013
Showing with 72 additions and 0 deletions.
  1. +45 −0 Ibelium/Ibelium.cpp
  2. +27 −0 Ibelium/Ibelium.h
View
@@ -0,0 +1,45 @@
+#include <"Ibelium.h">
+//Each function returns 1 if successful, 0 otherwise.
+
+
+int Ibelium::sendATCmd(char* cmd) {
+ char* buff;
+ int size;
+ Serial.print(cmd);
+ Serial.print((char)0xD);
+ Serial.print((char)0xA);
+ Serial.flush();
+ delay(2000);
+ if(Serial.available()>0)
+ {
+ size = Serial.available();
+ buff= (char*) malloc(sizeof(char) * Serial.available());
+ Serial.readBytes(buff, size);
+ }
+
+}
+
+int Ibelium::sendATQuery(char* cmd, char* response) {
+
+}
+
+int Ibelium::sendSMS(char* message, char* response) {
+
+}
+
+int init() {
+ //Initializes and tests the module.
+ Serial.begin(115200);
+ delay(2000);
+ pinMode(led, OUTPUT);
+ pinMode(onModulePin, OUTPUT);
+ switchModule(); //Switches the module on
+
+ return sendATCmd("AT");
+}
+
+void switchModule() {
+ digitalWrite(onModulePin,HIGH);
+ delay(2000);
+ digitalWrite(onModulePin,LOW);
+}
View
@@ -0,0 +1,27 @@
+/* Ibelium 3G module library. Allows for sending messages through text
+messages, uploading log files to an ftp server, and receiving text messages.
+
+
+*/
+#ifndef Ibelium_h
+#define Ibelium_h
+
+#include <Arduino.h>
+#include <SD.h>
+
+#define onModulePin 2
+#define led 13
+
+class Ibelium
+{
+public:
+ int init();
+ int sendSMS(char* message);
+
+private:
+ int sendATCmd(char* cmd);
+ void switchModule();
+};
+
+
+#endif

0 comments on commit 62b6cf1

Please sign in to comment.