VBNet to Arduino

So, we are having our thesis and our project is about printing machine.
so my part in the project is paper control. if the user is selecting either short or long paper.

The user is going to input the quantity of the document, then select either short or long paper, then the stepper which is going to rotate to get the paper out of the rack.

I just wanna ask "how can I program the quantity in Textbox in vbnet to multiply to the number of rotations in stepper motor?

Thank you in advance

What have you got so far?

Currently, i only have a program that the user choose either short or long using check box, but i cant make a program that you have to enter the quantity on textbox and every quantity is equal to how many rotation of the stepper to get the paper out of the rack.

the problem with this check box is the rotation depends on the arduino steps. I tried it with textbox but it keeps on rotating and didn’t stop.

my code is very basic so… yeah please help me

vb 2010

Imports System.IO
Imports System.IO.Ports
Imports System.Threading

Public Class Form1
Shared _continue As Boolean
Shared _serialPort As SerialPort
Dim WithEvents SerialPort1 As New SerialPort()

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SerialPort1.Close()
SerialPort1.PortName = “Com5”
SerialPort1.BaudRate = 9600
SerialPort1.DataBits = 8
SerialPort1.Parity = Parity.None
SerialPort1.StopBits = StopBits.One
SerialPort1.Handshake = Handshake.None
SerialPort1.Encoding = System.Text.Encoding.Default

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

If CheckBox1.Checked = True Then
SerialPort1.Open()

SerialPort1.Write(“0”)
SerialPort1.Close()

ElseIf CheckBox2.Checked = True Then
SerialPort1.Open()

SerialPort1.Write(“1”)
SerialPort1.Close()

End If

End Sub

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged, CheckBox2.CheckedChanged

Dim senderCheck As CheckBox = DirectCast(sender, CheckBox)
For Each checkbox In {CheckBox1, CheckBox2}

If checkbox IsNot senderCheck Then
checkbox.Enabled = Not senderCheck.Checked
End If
Next
End Sub

End Class

Arduino Code

#include <Stepper.h>
#define STEPS 60
Stepper stepper1(STEPS, 4, 5, 6, 7);
Stepper Stepss(STEPS, 8, 9, 10, 11);

void setup()
{
Serial.begin(9600);

}

void loop()
{

while (Serial.available() == 0);

int val = Serial.read() - ‘0’;

Serial.println(val);

if (val==0)
{
stepper1.setSpeed(460);
delay(50);
stepper1.step(7000);
delay(10);

digitalWrite(2,LOW);
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,LOW);
}

else if (val==1)

{
Stepss.setSpeed(460);
delay(50);
Stepss.step(-7000);
delay(10);

digitalWrite(8,LOW);
digitalWrite(9,LOW);
digitalWrite(10,LOW);
digitalWrite(11,LOW);
}

}

how can I program the quantity in Textbox in vbnet to multiply to the number of rotations in stepper motor

You don’t HAVE a number in a text box. You have text in a text box. You have to get that text converted to a number first. Then, you can use any math operations (you remember that class you nearly flunked?) to convert length to number of steps IF you know how many steps are needed to advance the paper some amount.