Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int state = 0;
- int numShots1 =1;
- int numShots2 =1;
- int counter1 =0;
- int counter2 =0;
- const int pin2 = 2;
- const int pin3 = 3;
- void setup()
- {
- Serial.begin(9600);
- }
- void loop()
- {
- if ((digitalRead(pin2) == LOW && state == 0) && (numShots1 > counter1)){
- Serial.print("\r");
- delay(1500);
- Serial.print("AT+CMGF=1\r");
- delay(1500);
- Serial.print("AT+CMGS=\"+64274035750\"\r");
- delay(1500);
- Serial.print("FILL THE TANK");
- delay(1500);
- Serial.write(0x1A);
- delay(1500);
- // while (digitalRead(pin2)== LOW && state == 0)
- counter1++;
- state == 1;
- }
- if (digitalRead(pin2) == HIGH && state == 0)
- {
- counter1 = 0;
- }
- if ((digitalRead(pin3) == HIGH && state == 0) && (numShots2 > counter2)) {
- Serial.print("\r");
- delay(1500);
- Serial.print("AT+CMGF=1\r");
- delay(1500);
- Serial.print("AT+CMGS=\"+64274035750\"\r");
- delay(1500);
- Serial.print("TANK FULL");
- delay(1500);
- Serial.write(0x1A);
- delay(1500);
- // while (digitalRead(pin3) == HIGH && state == 0)
- counter2++;
- state == 1;
- }
- if (digitalRead(pin3) == LOW && state == 0)
- {
- counter2 =0;
- }
- else {
- state = 0; }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement