Hi, I am having some difficuties with adding multiple numbers into my arduino sketch. I am currently a beginner and I would need some help. Thanks!
Heres my code!
#include <GPRS_Shield_Arduino.h>
#include <SoftwareSerial.h>
#include <Wire.h>
#include <Suli.h>
char numbers[3][12] = { "234324234", "23432423423", "123124323"}; // placeholder for 20 phone numbers
#define PIN_TX 7
#define PIN_RX 8
#define BAUDRATE 9600
#define PHONE_NUMBER { char aaa}
#define MESSAGE "hello,world"
GPRS gprsTest(PIN_TX,PIN_RX,BAUDRATE);//RX,TX,BaudRate
void setup() {
Serial.begin(9600);
Serial.println("gprs init success");
Serial.println("start to send message ...");
gprsTest.sendSMS(PHONE_NUMBER,MESSAGE); //define phone number and text
}
void loop() {
//nothing to do
}
Of course it doesn't work, since you never make any use of the array that contains the numbers.
Just to get started...
gprsTest.sendSMS(numbers[0][],MESSAGE); //define phone number and text
should work for the first phone number
Hi, what do i put for the empty box?
HaroldTech:
Hi, what do i put for the empty box?
nothing. The strings are null terminated.
But its gives this error...
Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Uno"
GPRS_SendSMS.ino: In function 'void setup()':
GPRS_SendSMS:20: error: expected primary-expression before ']' token
expected primary-expression before ']' token
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
system
July 26, 2015, 3:47pm
8
The second pair of brackets are not needed. The function expects a string, which is what numbers[0] is. numbers[0][0] would be a character.
Right. Duh.
gprsTest.sendSMS(numbers[0],MESSAGE); //define phone number and text
But that would only send to the first person
for (int giraffe = 0; giraffe <3; giraffe++) gprsTest.sendSMS(numbers[giraffe],MESSAGE);