Ali Nour
Published © GPL3+

Smartphone Minesweeper only by Arduino and 1Sheeld

Smartphone Minesweeper that sends its GPS location and a photo of the mine captured by the phone to your mail so you can take action!

IntermediateWork in progress1,823

Things used in this project

Story

Read more

Schematics

Schematic

Code

Untitled file

Arduino
#define CUSTOM_SETTINGS
#define INCLUDE_TOGGLE_BUTTON_SHIELD
#define INCLUDE_MAGNETOMETER_SENSOR_SHIELD
#define INCLUDE_EMAIL_SHIELD
#define INCLUDE_CAMERA_SHIELD
#define INCLUDE_GPS_SHIELD


#include <OneSheeld.h>

int motorAPin1 = 8;
int motorAPin2 = 11;
int motorBPin1 = 12;
int motorBPin2 = 13;
int motorASpeedPin = 9;
int motorBSpeedPin = 10;
bool flag=false;
float longitude,latitude;
String lon,lat,gps;
bool value;

void setup() {
  
OneSheeld.begin();

  pinMode(motorAPin1,OUTPUT);     
  pinMode(motorAPin2,OUTPUT);    
  pinMode(motorBPin1,OUTPUT);     
  pinMode(motorBPin2,OUTPUT);     
  pinMode(motorASpeedPin,OUTPUT); 
  pinMode(motorBSpeedPin,OUTPUT);
}
void loop() {
  value = ToggleButton.getStatus();
if(value){
    
      if(MagnetometerSensor.getMagneticStrength() < 110){
        
    analogWrite(motorASpeedPin, 255);   
    analogWrite(motorBSpeedPin, 255);
    digitalWrite(motorAPin1,LOW);
    digitalWrite(motorAPin2, HIGH);
    digitalWrite(motorBPin1,LOW);
    digitalWrite(motorBPin2, HIGH);  
      }
      else if (MagnetometerSensor.getMagneticStrength() > 110){
  flag=true;
}
if (flag==true){

    analogWrite(motorASpeedPin, 0);   
    analogWrite(motorBSpeedPin, 0);
    Camera.setFlash(ON);
    Camera.rearCapture();
    OneSheeld.delay(10000);
    longitude=GPS.getLongitude();
    latitude=GPS.getLatitude();
    lon=String(longitude);
    lat=String(latitude);
    gps="Langitude is: ";
    gps+=lon;
    gps+=" latitude is: ";
    gps+=lat;
    Email.attachLastPicture("alinour93@gmail.com","Landmine found!",gps,0);
    flag=false;
      }
    }
    else
    {
    analogWrite(motorASpeedPin, 0);   
    analogWrite(motorBSpeedPin, 0); 
  }
  
}

Code of the prototype

Credits

Ali Nour

Ali Nour

1 project • 2 followers

Comments