SYSTEM IMPLEMENTATION AND TESTING
4.1 interfaces implementation:
Front window:
This page will allow the user to connect the Arduino with the application.
Afterward, the user can use the application throw the remote control
Connecting Arduino:
This page will search for the Arduino and connect it with the
application.
18 |
P a g e
Remote control:
This button will take the user to the next page which allow the user to use
the application and control the house.
Figure 18:Front window
Front window:
This page will allow the user to connect the Arduino with the application.
Afterward, the user can use the application throw the remote control
19 |
P a g e
Connecting Arduino:
This page will search for the Arduino and connect it with the
application.
Figure 19: Connect Arduino
20 |
P a g e
Remote control:
This button will take the user to the next page which allow the user to use
the application and control the house.
4.2 Code implementation:
◼
Connect Device Activity:
package com.example.homeautomationarduino;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
public class ConnectDeviceActivity extends AppCompatActivity {
Figure 20:Remote Control
21 |
P a g e
ActionBar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.
activity_connect_device
);
toolbar = getSupportActionBar();
toolbar.setTitle("Connect Your Arduino");
toolbar.setDisplayHomeAsUpEnabled(true);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.
home
) {
this.finish();
}
return super.onOptionsItemSelected(item);
}
}
◼
Main Activity:
package com.example.homeautomationarduino;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.
activity_main
);
}
public void openRemoteControlBTN(View view)
{
Intent intent = new Intent(this, RemoteControlActivity.class);
startActivity(intent);
}
public void openConnectionActivityBTN(View view)
{
Intent intent = new Intent(this, ConnectDeviceActivity.class);
startActivity(intent);
}
}
◼
Remote Control Activity:
22 |
P a g e
package com.example.homeautomationarduino;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
public class RemoteControlActivity extends AppCompatActivity {
ActionBar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.
activity_remote_control
);
toolbar = getSupportActionBar();
toolbar.setDisplayHomeAsUpEnabled(true);
toolbar.setTitle("Remote Control");
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.
home
) {
this.finish();
}
return super.onOptionsItemSelected(item);
}
}
4.3 Technology used:
We used some tools and software’s that help to build the system:
4.3.1 Android studio:
it’s a software that use for creating the interfaces for the application that we have in the system by
writing some codes and also its supported with connection to the database.
4.3.2 Arduino software:
it’s a software that use for writing and uploading the code of how the board work to the Arduino
board.
23 |
P a g e
Do'stlaringiz bilan baham: |