Ozirock's Projects

"A person who never made a mistake never tried anything new" - Albert Einstein

PC User Control

Members Area

 

 

 

Useful Tools

 

 

Recent Videos

2673 views - 0 comments
2215 views - 0 comments
2153 views - 0 comments

Newest Members

 

 

 

Computer Controlled RC Car

I used a velleman k8055 usb interface board to communicate with the rc controller through a visual basic program I made with the help of the guys at www.vbforums.com. You can find the link to the relevant forum pages here. So far I have been able to control the car using a couple of the letter buttons as follows:

  • a = Forward
  • z = Backward
  • k = Left
  • l = Right
It is my aim to control the car from arrow keys but as of yet I haven't gotten the code working yet, when I do i'll post it here. 
 
Below you'll find the code which I made with the help of the guys at vbforums.com, this has one button to connect to the board and four labels to show that the code is working. Also below you'll find an image of the user interface.
 
 
vb code: 

Public Class Form1 Private Declare Function OpenDevice Lib "k8055d.dll" (ByVal CardAddress As Integer) As Integer Private Declare Sub SetDigitalChannel Lib "k8055d.dll" (ByVal Channel As Integer) Private Declare Sub ClearDigitalChannel Lib "k8055d.dll" (ByVal Channel As Integer) Public up, down, lleft, rright As Boolean 'to keep track of which buttons are already pressed Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim CardAddress As Integer Dim h As Integer CardAddress = 3 h = OpenDevice(3) Label1.Text = "Card " + Str(h) + " connected" End Sub Private Sub MainForm_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown Select Case e.KeyCode Case Keys.A : SetDigitalChannel(1) : Label5.ForeColor = Color.Red Case Keys.L : SetDigitalChannel(2) : Label4.ForeColor = Color.Red Case Keys.Z : SetDigitalChannel(3) : Label2.ForeColor = Color.Red Case Keys.K : SetDigitalChannel(4) : Label3.ForeColor = Color.Red End Select End Sub Private Sub MainForm_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp Select Case e.KeyCode Case Keys.A : ClearDigitalChannel(1) : Label5.ForeColor = Color.Black Case Keys.L : ClearDigitalChannel(2) : Label4.ForeColor = Color.Black Case Keys.Z : ClearDigitalChannel(3) : Label2.ForeColor = Color.Black Case Keys.K : ClearDigitalChannel(4) : Label3.ForeColor = Color.Black End Select End Sub End Class


 
And finally here is a video of the car being controlled from the laptop.