Computer Controlled Cutting
📱

Interface and application programming

WEEK 14

This week’s assignment:

The Idea

Creating the plan

Creating the app

For making the APP I am using the MIT App Inventor, as I’m weak in coding and the MIT app Inventor is the best method for those who are new to programming and coding,

There is also an alternative to MIT app Inventor “KODULAR” which is built on top of the app inventor and has more modern UI designs than the app inventor

MIT App inventor

MIT App Inventor is a web-based platform that allows users to create mobile applications for Android devices without needing to know how to write code. It uses a visual drag-and-drop interface to create the app's user interface and a block-based programming language to define the app's behavior.

* Created a new project called “test1”

The layout of the app that im going to make

insert the drawing here”

Designing the app

there are mainly two windows here the block and designer, The block editor in MIT App Inventor is used to define the behavior and functionality of an app, While the designer is used to create the app's user interface.

The interface / Designer section

  • these are the components that we need to make the user interface of the app

Blocks / behavior and functionality

Screen 3

Screen 1

now the app is complete.

  • you can download the apk here >>>

  • or we can scan the QR code to use it on MIT A12 companion for live testing of the app

Programming the board

This is a custom board with ESP WROOM 02D chip

Circuit connection

Connect the Echo pin to PIN 05 of the board and the Trigger pin to PIN 04

Code

//*********************Wifi AP Settings******************************
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>

/* Set these to your desired credentials. */
const char *ssid = "DistanceMeter";
const char *password = "";

ESP8266WebServer server(80);

// Pins

const int trigPin = 4;
const int echoPin = 5;


void setup() {

  Serial.begin(115200);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  //********************Access Point Setup******************************
  Serial.print("Configuring access point...");
  WiFi.softAP(ssid, password);

  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);
  //****************** Server Setting **********************************
  server.on("/read", handleRooto);  // call "handleRooto" if request is "/read"
  server.begin();  // Start server
  Serial.println("HTTP server started");
}

void loop() {
  server.handleClient();  //HandleClient Request
}

void handleRooto() {
  int distance = readDistance();
  server.send(200, "text/plane", String(distance));
  Serial.println(distance);
}
int readDistance() {
  int duration, distance;
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = duration * 0.034 / 2;
  return distance;
}

Configuring the App

unfortunately, the last update of the app didn’t work on my phone, so here’s the video from the previous testing phase, the function is the same there’s only a change in the background, you can also see the values changing in the serial monitor.