this code for control weight ( weight material a - weight material b - weight material c ) i want to edit my code that i can enter a - b- c in first start and run program and how many times that i want to repeat this valus
//
#include "Arduino.h"
#include "HX711.h"
#define DOUT 3
#define CLK 2
[color=red][b]
int a = 3;
int b = 2;
int c = 5;[/b][/color]
HX711 scale(DOUT, CLK);
// Calibration magic number for Load Cell
float calibration_factor = 41500;
unsigned long time;
// --------------------------------------------------------------------------------------
// SET UP SET UP SET UP SET UP SET UP SET UP SET UP SET UP SET UP
// --------------------------------------------------------------------------------------
void setup() {
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
Serial.begin(9600);
Serial.println("weighting system");
scale.set_scale();
scale.tare(); //Reset the scale to 0
}
// --------------------------------------------------------------------------------------
// LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP
// --------------------------------------------------------------------------------------
void loop()
{
//Adjust to this calibration factor
scale.set_scale(calibration_factor);
// Read an average of X readings
float weight = scale.get_units(10);
// An intermediate weight value that we round according to some rules
int netWeight = 0;
// Make scale more sensitive at lower end
// Weight > X then just round to nearest integer
if (weight >= 5.0) {
netWeight = (weight * 10.0);
weight = (int) (0.5 + (netWeight / 10.0));
}
// Weight < Y then call it zero
else if (weight > -0.01 && weight <= 0.01) {
weight = 0;
}
// Any other weight will have 1 dec. place of precision
else {
netWeight = (weight * 10.0);
weight = (netWeight / 10.0);
}
if (weight <= 0) {
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
digitalWrite(6,LOW);
}
else if ((weight >= a)&& (weight < a+b ) ) {
digitalWrite(4, LOW);
digitalWrite(5,HIGH);
digitalWrite(6,LOW);
}
else if ((weight >= a+b )&& (weight < a+b+c) ) {
digitalWrite(4, LOW);
digitalWrite(5,LOW);
digitalWrite(6,HIGH);
}
else if (weight >= 500) { //hot
digitalWrite(4, LOW);
digitalWrite(5,LOW);
digitalWrite(6,LOW);
delay(5000);
}
Serial.print("weight = ");
Serial.println(weight ,1);
}
.
and this prog in vb to show weight in pc and i want to edit this code that i can enter a - b- c in first start and run program and how many times that i want to repeat this valus
//
Public Class Form1
Private WithEvents objserial As New System.IO.Ports.SerialPort("COM6")
Private currentweight As Double
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
objserial.BaudRate = 9600
objserial.Open()
End Sub
Private Sub objserial_DataReceived(sender As Object, e As IO.Ports.SerialDataReceivedEventArgs) Handles objserial.DataReceived
Dim S As String = objserial.ReadLine
If S.Contains("weight") Then
S = S.Replace("weight =", "")
If IsNumeric(S) Then
currentweight = CDbl(S)
tbweight.Invoke(New updateweightboxdelegate(AddressOf updateweightbox), currentweight.ToString + "kg")
End If
End If
End Sub
Delegate Sub updateweightboxdelegate(ByVal t As String)
Public Sub updateweightbox(ByVal t As String)
tbweight.Text = t
End Sub
End Class
.