hello, I wanted to see if anyone has tried controlling a DC motor? I know the GPIO library for xojo comes with servo motors and how to control them. But, I am struggling to do it with a DC motor.
GPIO.SetupGPIO
const kServoPin = 24
Dim servo As New GPIO.Servo(kServoPin)
///GPIO.PinMode(kLEDPin, GPIO.OUTPUT)
//While True
//GPIO.DigitalWrite (kLEDPin, GPIO.ON)
//App.DoEvents (500)
If servo.ErrorCode = 0 Then
servo.Neutral
App.DoEvents(500)
servo.Left
End If
GPIO.Cleanup
^^ this is some of the code that I’ve tried
I have changed my code a bit I am not sure if this would work
GPIO.SetupGPIO
const Pin1 = 24
const Pin2 = 23
const Pin3 = 35
GPIO.PinMode(pin1, GPIO.OUTPUT)
GPIO.PinMode(pin2, GPIO.OUTPUT)
GPIO.PinMode(pin3, GPIO.OUTPUT)
GPIO.DigitalWrite(Pin3,GPIO.ON)
GPIO.SoftPwmWrite(Pin3,100)
if Up is pressed
GPIO.DigitalWrite(Pin1,GPIO.HIGH)
GPIO.DigitalWrite(Pin2,GPIO.LOW)
App.DoEvents(500)
End If
GPIO.Cleanup()
Xojo is not the best option to work with GPIO but if you really want to do it, there is a book about this:
You can do many things with the Raspberry Pi, and some have built a Star Trek interface, while others have built robots. This book provides the building block to work with Xojo to react with the real world through its motherboard to allow you to make your own interesting device. This inexpensive computer can be programed by the widely recognized Xojo programming language.
This book I Wish I Knew How to
Program Raspberry Pi 3B+ Electronics with Xojo goes into the numerous programs that can b…
MarkusR
(MarkusR)
November 5, 2022, 6:25am
4
you mean a stepping motor?
I’ll take a look into this thank you.