I need a way to control a stepper motor with visual basic.
I'm using an Arduino UNO, TB6600 Driver, and Nema 17 stepper motor.
I can make the stepper motor home at the desired position, and change the position with a textbox in Visual Studio (2019).
I need the motor to wait until the start button is pressed, and stop with the stop button is pressed.
I've put over 2 weeks of time into figuring it out, but I can't get it. I found a few projects where I can achieve desirable results using the Arduino serial monitor but, I can't make it work with Visual Studio.
PS: this is my first time using VS and Arduino.
VS Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
serialPort1.Open();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Double a;
Double v = Double.Parse(textBox1.Text);
a = v;
serialPort1.Write(a.ToString());
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
serialPort1.Write("B");
}
private void button3_Click(object sender, EventArgs e)
{
serialPort1.WriteLine("A");
}
private void label1_Click(object sender, EventArgs e)
{
}
}
}
Stepper_Position.ino (2.89 KB)