algorithmic modeling for Rhino
I like to control one simple stepper motor to understand the basics, as blink does not work (as it has no wait/sleep) I try to get it done with VB. But I am just starting coding with VB in Rhino or VB at all.
How can I give out a 0, than a 1 and then have a very short break?
I use a EasyDriver 4.4 controlled by my Arduino Uno. I can get the stepper to move with an arduino code directly:
digitalWrite(steppin, LOW);
digitalWrite(steppin, HIGH);
delayMicroseconds(500);
I added some code I made up googling a lot trying to mimic the code above in VB/GH. Can someone help me get it right?
Private Sub RunScript(ByVal x As Object, ByVal y As Object, ByRef A As Object)
Dim counter As Integer = 0
Do
A = 0
A = 1
system.threading.thread.sleep(10)
counter += 1
Loop Until counter= 100
End Sub
Tags:
Hi Paul!
As far as I know it is not possible to control motors that way. You would need a parallel port to control motors directly. Also a OS like Windows would not be optimal for such operations.
The usual way is that the PC gives the Arduino high level commands like "move to point x with speed v". The Arduino converts these commands and controls the motors at low level (send zeros and ones).
You can communicate with your Arduino via USB. In C#/VB this can be done with System.IO.Ports.SerialPort.
On the Arduino side you need code that handles the received messages from the PC and controls the steppers. For cnc stuff I recommend you to use grbl.
Greetings!
Well, firefly follows the same principle as I mentioned. The point is that you can't do the "0-1-pause" thing for the stepper on the PC with VB. USB-Ports are not designed for such things. That's what the microcontroller is for (Arduino with Firefly, grbl, own code,...).
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by