File tree 6 files changed +72
-0
lines changed 6 files changed +72
-0
lines changed Original file line number Diff line number Diff line change
1
+ .pio
2
+ .vscode /.browse.c_cpp.db *
3
+ .vscode /c_cpp_properties.json
4
+ .vscode /launch.json
5
+ .vscode /ipch
Original file line number Diff line number Diff line change
1
+ {
2
+ // See http://go.microsoft.com/fwlink/?LinkId=827846
3
+ // for the documentation about the extensions.json format
4
+ "recommendations" : [
5
+ " platformio.platformio-ide"
6
+ ],
7
+ "unwantedRecommendations" : [
8
+ " ms-vscode.cpptools-extension-pack"
9
+ ]
10
+ }
Original file line number Diff line number Diff line change
1
+ #ifndef FIRMWARE_H
2
+ #define FIRMWARE_H
3
+
4
+ #include <SoftwareSerial.h>
5
+ #include <SIM900.h>
6
+
7
+ static SoftwareSerial shieldSerial (7 , 8 );
8
+ static SIM900 sim900 (& shieldSerial );
9
+
10
+ void sendOTP (String number , String email , String otp );
11
+
12
+ #endif
Original file line number Diff line number Diff line change
1
+ ; PlatformIO Project Configuration File
2
+ ;
3
+ ; Build options: build flags, source filter
4
+ ; Upload options: custom upload port, speed and extra flags
5
+ ; Library options: dependencies, extra library storages
6
+ ; Advanced options: extra scripting
7
+ ;
8
+ ; Please visit documentation for the other options and examples
9
+ ; https://docs.platformio.org/page/projectconf.html
10
+
11
+ [env:uno]
12
+ platform = atmelavr
13
+ board = uno
14
+ framework = arduino
15
+ lib_deps = nthnn/SIM900@^1.0.0
Original file line number Diff line number Diff line change
1
+ #include < firmware.h>
2
+
3
+ void sendOTP (String number, String email, String otp) {
4
+ Serial.println (sim900.sendSMS (number, " Your one-time password (OTP) is " + otp +
5
+ " . Do not share your OTP to anyone. If you did not request for your OTP, report at " +
6
+ email + " .\n\n (Sent via QLBase)" ) ? F (" SENT" ) : F (" ERR" )
7
+ );
8
+ }
Original file line number Diff line number Diff line change
1
+ #include < Arduino.h>
2
+ #include < firmware.h>
3
+
4
+ void setup () {
5
+ Serial.begin (9600 );
6
+ }
7
+
8
+ void loop () {
9
+ if (Serial.available () > 0 ) {
10
+ String serialString = Serial.readString ();
11
+ serialString.trim ();
12
+
13
+ int delim1 = serialString.indexOf (F (" ," )),
14
+ delim2 = serialString.lastIndexOf (F (" ," ));
15
+
16
+ sendOTP (
17
+ serialString.substring (0 , delim1),
18
+ serialString.substring (delim1 + 1 , delim2),
19
+ serialString.substring (delim2 + 1 )
20
+ );
21
+ }
22
+ }
You can’t perform that action at this time.
0 commit comments