I could still not get it to work, here is my updated codes:
////Libs//////////////////////////////////
#include <Key.h>
#include <Keypad.h>
#include <SoftwareSerial.h>
//////////////////////////////////////////
///SoftwareSerial/////////////////////////
SoftwareSerial sim900(2, 3);
//////////////////////////////////////////
////Bytes/////////////////////////////////
const byte nbDigitInPhoneNb = 8;
/////////////////////////////////////////
////char//////////////////////////////////
char telNR[nbDigitInPhoneNb+1];
char key;
//////////////////////////////////////////
////INTes/////////////////////////////////
int antT = 0;
//////////////////////////////////////////
////Tast opsett - keyPad//////////////////
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
char keys[ROWS][COLS] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
/////////////////////////////////////////
////Pin oppsett///////////////////////////
byte rowPins[ROWS] = {3, 4, 5, 8};
byte colPins[COLS] = {9, 10, 11, 12};
//////////////////////////////////////////
////Oppsett keyPad////////////////////////
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
//////////////////////////////////////////
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
sim900.begin(9600);
reset();
}
void loop() {
// put your main code here, to run repeatedly:
key = keypad.getKey();
if (key) {
if (key >= '0' && key <= '9' && antT < 8) {
telNR[antT] = key;
antT++;
}
}
if (antT >= nbDigitInPhoneNb) {
telNR[nbDigitInPhoneNb] = '\0';
sim900.print("ATD");
sim900.print(telNR);
sim900.println(";");
Serial.println("Ringer....");
Serial.print(telNR);
reset();
}
}
void reset() {
antT = 0;
//memset(telNR, '\0', nbDigitInPhoneNb+1);
}
Is this right?
Thanks again ![]()