Coding

Hello .. Can you help me with my project. In my project, have current sensors, touch sensor and half bridge sensor. So i need to connect all together with wifi module and make GUI. Can you hfelp me the coding to combine all the sensors with wifi module.

TOUCH SENSOR CODE:

void setup()
{
Serial.begin(9600);
pinMode(2,INPUT);
pinMode(3,INPUT);
pinMode(4,INPUT);
pinMode(5,INPUT);
}
void loop()
{
int touch1=digitalRead(2);
int touch2=digitalRead(3);
int touch3=digitalRead(4);
int touch4=digitalRead(5);
if (touch1== HIGH)
{
Serial.println("1 is pressed");
}
delay(200);
if (touch2== HIGH)
{
Serial.println("2 is pressed");
}
delay(200);
if (touch3== HIGH)
{
Serial.println("3 is pressed");
}
delay(200);
if (touch4== HIGH)
{
Serial.println("4 is pressed");
}
delay(200);
}

CURRENT SENSOR CODE :

#include <LiquidCrystal.h>

LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

const int currentPin = A0;
int sensitivity = 66;
int adcValue= 0;
int offsetVoltage = 2500;
double adcVoltage = 0;
double currentValue = 0;

void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
lcd.print(" Current Sensor ");
lcd.setCursor(0,1);
lcd.print(" with Arduino ");
delay(2000);
}

void loop()
{
adcValue = analogRead(currentPin);
adcVoltage = (adcValue / 1024.0) * 5000;
currentValue = ((adcVoltage - offsetVoltage) / sensitivity);

Serial.print("Raw Sensor Value = " );
Serial.print(adcValue);

lcd.clear();
delay(1000);
//lcd.display();
lcd.setCursor(0,0);
lcd.print("ADC Value = ");
lcd.setCursor(12,0);
lcd.print(adcValue);

delay(2000);

Serial.print("\t Voltage(mV) = ");
Serial.print(adcVoltage,3);

lcd.setCursor(0,0);
lcd.print("V in mV = ");
lcd.setCursor(10,0);
lcd.print(adcVoltage,1);

delay(2000);

Serial.print("\t Current = ");
Serial.println(currentValue,3);

lcd.setCursor(0,0);
lcd.print("Current = ");
lcd.setCursor(10,0);
lcd.print(currentValue,2);
lcd.setCursor(14,0);
lcd.print("A");
delay(2500);
}

HALF BRIDGE LOAD CELL CODE:

#include "HX711.h"

HX711 scale(5, 6);

float calibration_factor = 48100; // this calibration factor is adjusted according to my load cell
float units;
float ounces;

void setup() {
Serial.begin(9600);
Serial.println("HX711 calibration sketch");
Serial.println("Remove all weight from scale");
Serial.println("After readings begin, place known weight on scale");
Serial.println("Press + or a to increase calibration factor");
Serial.println("Press - or z to decrease calibration factor");

scale.set_scale();
scale.tare(); //Reset the scale to 0

long zero_factor = scale.read_average(); //Get a baseline reading
Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
Serial.println(zero_factor);
}

void loop() {

scale.set_scale(calibration_factor); //Adjust to this calibration factor

Serial.print("Reading: ");
units = scale.get_units(), 10;
if (units < 0)
{
units = 0.00;
}
ounces = units * 0.035274;
Serial.print(units);
Serial.print(" kg");
Serial.print(" calibration_factor: ");
Serial.print(calibration_factor);
Serial.println();
delay(500);

if(Serial.available())
{
char temp = Serial.read();
if(temp == '+' || temp == 'a')
calibration_factor += 1;
else if(temp == '-' || temp == 'z')
calibration_factor -= 1;
}
}

Wifi Code :

void setup() {
// initialize digital esp8266 gpio 2 as an output.
pinMode(2, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(2, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(2, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

And tell me how to connect wifi with GUI . THAN YOU

If you are attempting to combine code, arduino.cc has some tips for this. Google is your friend.

If you want code written for you, post in "Gigs and Collaborations" and bring your wallet - but one of the nice things about Arduino is that you get to write your own code.

Hello Lynn,
welcome to the forum.

your question sounds almost like "can you code the rest of my project"
I guess nobody wants to do so much work for you just for a "Thank you very much"

code-button:
As this is your very first post I want to write some basic information. You should follow some rules to get better help.

If you want to post code use the insert code-Button. This butto looks like this: <|>. You can find this button if you use the reply-function instead of the quick-reply function. If you click on reply you get a menu right above the textinput-field
at the left end of this menu you wil finde the <|>-Button.

Code in such a code-section is written in a constant-distance-font which will show all the indentions the same way as in the IDE. And with a simple click the users can put the whole code into the clipboard.

you should ask concrete questions. The question you wrote above is way too global.

best regards Stefan

Please edit your post to add code tags, as described in "How to use the forum".

Possibly of some use:

http://www.thebox.myzen.co.uk/Tutorial/Merging_Code.html

https://arduinoinfo.mywikis.net/wiki/CombiningArduinoSketches