⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 directcontrol.frm

📁 利用vb控制乐高机器人
💻 FRM
字号:
VERSION 5.00
Object = "{D6CD40C0-A522-11D0-9800-D3C9B35D2C47}#1.0#0"; "spirit.ocx"
Begin VB.Form Form1 
   Caption         =   "上海西觅亚公司"
   ClientHeight    =   3075
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   15.75
      Charset         =   134
      Weight          =   700
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   ScaleHeight     =   3075
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton cmdStop 
      Caption         =   "停止"
      Height          =   615
      Left            =   1680
      TabIndex        =   5
      Top             =   1200
      Width           =   1215
   End
   Begin SPIRITLib.Spirit Lego 
      Height          =   495
      Left            =   3960
      TabIndex        =   4
      Top             =   2520
      Width           =   615
      _Version        =   65536
      _ExtentX        =   1085
      _ExtentY        =   873
      _StockProps     =   0
   End
   Begin VB.CommandButton cmdDown 
      Caption         =   "向后"
      Height          =   615
      Left            =   1680
      TabIndex        =   3
      Top             =   2040
      Width           =   1215
   End
   Begin VB.CommandButton cmdLeft 
      Caption         =   "左转"
      Height          =   615
      Left            =   240
      TabIndex        =   2
      Top             =   1200
      Width           =   1215
   End
   Begin VB.CommandButton cmdright 
      Caption         =   "右转"
      Height          =   615
      Left            =   3120
      TabIndex        =   1
      Top             =   1200
      Width           =   1215
   End
   Begin VB.CommandButton cmdUp 
      Caption         =   "向前"
      Height          =   615
      Left            =   1680
      TabIndex        =   0
      Top             =   360
      Width           =   1215
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdDown_Click()


 '向下
    Lego.SetFwd "02"
    Lego.On "motor0motor2"
    a = Lego.SetPower("02", 2, 1)
End Sub

Private Sub cmdLeft_Click()

 '向左
    Lego.SetRwd "2"
    Lego.SetFwd "0"
    a = Lego.SetPower("02", 2, 4)
    Lego.On "motor0motor2"
End Sub

Private Sub cmdright_Click()
 '向右
    Lego.SetRwd "0"
    Lego.SetFwd "2"
    Lego.On "motor0motor2"
    a = Lego.SetPower("02", 2, 4)
End Sub

Private Sub cmdStop_Click()
 '停止
    Lego.Off ("02")
End Sub

Private Sub cmdUp_Click()
'向上
    Lego.SetRwd "2"
    Lego.SetRwd "0"
    a = Lego.SetPower("02", 2, 1)
    Lego.On "motor0motor2"
    
End Sub

Private Sub Form_Load()
    
    Lego.InitComm    '初始化端口
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -