Jump to content

Harry88

Members
  • Gesamte Inhalte

    5
  • Benutzer seit

  • Letzter Besuch

Posts erstellt von Harry88

  1. Jetzt habe ich alle Fehler korrigiert und die Anwendung läuft. Allerdings kommen die ganzen Messschritte in einem Affenzahn hintereinander so dass die Motoren garnicht dazu kommen zu laufen. Wie kann ich einstellen, dass es langsamer abläuft?

     

     

    Ich kann diese Fehlermeldungen nicht nachstellen. Ich tue folgendes:

     

    In Visual Studio 2015 ein neues Visual Basic Projekt anlegen über Neu -> Projekt -> Visual Basic -> Windows -> Klassischer Desktop -> Konsolenanwendung. Dann nehme ich deinen Visual Basic Code und ersetzte damit den Inhalt der Module1.vb Datei die Visual Studio erzeugt hat. Dann füge ich die Tinkerforge.dll auf dem VB.NET Bindings ZIP als Verweis hinzu. Fertig. Das hat zwar andere Fehler, weil du im Code noch einige Tippfehler drin hast, aber ich bekomme keine Fehler über IPConnection oder BrickStepper.

  2. Jetzt hat es funktioniert. Es war die dll-Anbindung die noch aktiviert war.Im folgenden der korrigierte code. Jetzt kam folgende Meldung:steppery As New BrickStepper(UIDy, ipcon)>An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in Tinkerforge.dll

     

    Additional information: Specified argument was out of the range of valid values.

     

    Wie kann ich hier Abhilfe schaffen?

    Hier der korrigierte Code:

    Imports System

    Imports Tinkerforge

     

    Module MeasureAltoReed

        Const HOST As String = "localhost"

        Const PORT As Integer = 4223

        Const UIDx As String = "5W5E6E"    ' Change XXYYZZ to the UID of your x direction Stepper Brick

        Const UIDy As String = "67PGPm "    ' Change XXYYZZ to the UID of your y direction Stepper Brick

     

        Dim digmetervalue As Decimal = 0

     

        Sub Main()

            Dim ipcon As New IPConnection()                        ' Create IP connection

            Dim stepperx As New BrickStepper(UIDx, ipcon)  ' Create device object for x direction stepper

            Dim steppery As New BrickStepper(UIDy, ipcon)  ' Create device object for y direction stepper

     

            ipcon.Connect(HOST, PORT) ' Connect to brickd Don't use device before ipcon is connected

     

            stepperx.SetSpeedRamping(30000, 30000)    '    Set stepper x values

            stepperx.SetMaxVelocity(5000)

            stepperx.SetDecay(50000)

            stepperx.Enable()                                              '  Enable x motor power

            stepperx.SetStepMode(4)

     

            steppery.SetSpeedRamping(30000, 30000)    '    Set stepper y values

            steppery.SetMaxVelocity(5000)

            steppery.SetDecay(50000)

            steppery.Enable()                                              '  Enable y motor power

            steppery.SetStepMode(4)

     

            Console.WriteLine("Press key to start")

            Console.ReadLine()

     

            Dim currentxpos As Integer

            Dim currentypos As Integer

            Dim distancexaway As Integer

            Dim distanceyaway As Integer

     

            For x As Integer = -9 To 9

                currentxpos = stepperx.GetCurrentPosition()

                distancexaway = x - currentxpos

                stepperx.SetSteps(distancexaway)

     

                For y As Integer = 35 To 73

                    currentypos = steppery.GetCurrentPosition()

                    distanceyaway = y - currentypos

                    steppery.SetSteps(distanceyaway)

     

                    Console.WriteLine("Current position ( x , y ) (" + x.ToString() + ", " + y.ToString() + ")")

     

                    ' Get reed measurement and output

                Next y

            Next x

     

            stepperx.Disable()

            steppery.Disable()

            ipcon.Disconnect()

        End Sub

    End Module

     

     

    Ich kann diese Fehlermeldungen nicht nachstellen. Ich tue folgendes:

     

    In Visual Studio 2015 ein neues Visual Basic Projekt anlegen über Neu -> Projekt -> Visual Basic -> Windows -> Klassischer Desktop -> Konsolenanwendung. Dann nehme ich deinen Visual Basic Code und ersetzte damit den Inhalt der Module1.vb Datei die Visual Studio erzeugt hat. Dann füge ich die Tinkerforge.dll auf dem VB.NET Bindings ZIP als Verweis hinzu. Fertig. Das hat zwar andere Fehler, weil du im Code noch einige Tippfehler drin hast, aber ich bekomme keine Fehler über IPConnection oder BrickStepper.

  3. Danke für deine Antwort. Ich habe Visual Basic Studio Community. Dort gibt es New Project>Visual Basic> dann gibt es folgende Auswahl:

    - Windows Forms Application

    - WPF Application

    - Console Application

    - Shared Project

    - Class Library

    - Class Library(Portable)

     

    Bisher habe ich Console Application verwendet.

    Klassischer Desktop habe ich nicht gefunden. Oder ist Console Application die englische Version von klassischer Desktop? Mit Console Application hat es jedenfalls nicht funktioniert. Aber ich werde es noch einmal versuchen. So wie du geschrieben hast.

     

  4. Following is a VB code for 2 stepper bricklets.  The hardware works with the example shown on the Tinkerforge homepage.  Can anybody tell me why this my code does not work and what I have to change? The 3 error messages from Visual Basic are shown at the end of the code.

     

    The code is for a two axis measuring tool to move the table.

     

    Thank you!

     

    Best,

    Harry

     

    Code for Reed Measuring Device

    OUTLINE

    ​Module MeasureReed

    Reset device position​

    WaitForStart() 

    For x = 35 to 71 by 1

      ​For y = -9 to 9 by 1

    ​​MoveDeviceTo(x,y)

    ​    ​MeasureReed()

            ​Output measurement

    ​Next y

    ​​Move Excel cursor back up and to right

    Next x

    ​End Module

     

    Visual Basic Code

    Imports System

    Imports Tinkerforge

     

    Module MeasureAltoReed

      Const HOST As String = "localhost"

      Const PORT As Integer = 4223

      Const UIDx As String = "5W5E6E"    ' Change XXYYZZ to the UID of your x direction Stepper Brick

      Const UIDy As String = "67PGPm "    ' Change XXYYZZ to the UID of your y direction Stepper Brick

     

      Sub Main()

          Dim ipconx As New IPConnection()                        ' Create IP connection for x

    ​ Dim ipcony As New IPConnection()                        ' Create IP connection for y

          Dim stepperx As New BrickStepper(UIDx, ipconx)  ' Create device object for x direction stepper

          Dim steppery As New BrickStepper(UIDy, ipcony)  ' Create device object for y direction stepper

     

          ipcon.Connect(HOST, PORT) ' Connect to brickd Don't use device before ipcon is connected

     

          stepperx.SetSpeedRamping(30000, 30000)    '    Set stepper x values

          stepperx.SetMexVelocity(5000)

          stepperx.StepDecay(50000)

          stepperx.Enable()                                              '  Enable x motor power

          stepperx.SetStepMode(4)

     

          steppery.SetSpeedRamping(30000, 30000)    '    Set stepper y values

          steppery.SetMexVelocity(5000)

          steppery.StepDecay(50000)

          steppery.Enable()                                              '  Enable y motor power

          steppery.SetStepMode(4)

     

          Console.WriteLine("Press key to start")

          Console.ReadLine()

     

          Dim currentxpos As Integer = 0

          Dim currentypos As Integer = 82

          Dim distancexaway As Integer

          Dim distanceyaway As Integer

     

    ​ distancexaway = -9 – currentxpos      ​‘ Move to (-9,35) from start (0,82)

    stepperx.SetSteps(distancexaway*800)    ‘ 800 steps = 1 mm

    currentxpos = currentxpos + distancexaway

     

    distanceyaway = 35 – currentypos

    steppery.SetSteps(distanceyaway*800)

    ​ currentypos = currentypos + distanceyaway

     

          For x As Integer = -9 To 9

              distancexaway = x - currentxpos

              stepperx.SetSteps(distancexaway*800)

        currentxpos = currentxpos + distancexaway

     

              For y As Integer = 35 To 73

                  distanceyaway = y - currentypos

              ​  steppery.SetSteps(distanceyaway*800)

            currentypos = currentypos + distanceyaway

     

                  Console.WriteLine("Current position ( x , y ) (" + x.ToString() + ", " + y.ToString() + ")")

     

                  ' Get reed measurement and output

              Next y

          Next x

     

          stepperx.Disable()

          steppery.Disable()

          ipcon.Disconnect()

      End Sub

    End Module

     

     

    Severity

     

    Code

     

    Description

     

    Project

     

    File

     

    Line

     

    Suppression State

     

    Error

     

    BC30002

     

    Type 'IPConnection' is not defined.

     

    MeasuringTollCorr.4

     

    c:\users\boss\documents\visual studio 2015\Projects\MeasuringTollCorr.4\MeasuringTollCorr.4\Module1.vb

     

    13

     

    Active

     

    Error

     

    BC30002

     

    Type 'BrickStepper' is not defined.

     

    MeasuringTollCorr.4

     

    c:\users\boss\documents\visual studio 2015\Projects\MeasuringTollCorr.4\MeasuringTollCorr.4\Module1.vb

     

    14

     

    Active

     

    Error

     

    BC30002

     

    Type 'BrickStepper' is not defined.

     

    MeasuringTollCorr.4

     

    c:\users\boss\documents\visual studio 2015\Projects\MeasuringTollCorr.4\MeasuringTollCorr.4\Module1.vb

     

    15

     

    Active

     

     

    ReplyQuoteNotify

     

  5.  

    Im Folgenden eine Programmierung für 2 Stepper Bricklets. Die Hardware funktioniert mit den Beispielen für die Stepper auf der Tinkerforge Website. Kann mir jemand sagen warum die unten stehende Programmierung nicht funktioniert und wie ich das Ändern kann. Die drei Fehlermeldungen sind ganz unten.

     

    Vielen Dank!

     

    Gruß,

    Harry

     

    Code for Reed Measuring Device

    OUTLINE

    ​Module MeasureReed

    Reset device position​

    WaitForStart() 

    For x = 35 to 71 by 1

      ​For y = -9 to 9 by 1

    ​​MoveDeviceTo(x,y)

    ​    ​MeasureReed()

            ​Output measurement

    ​Next y

    ​​Move Excel cursor back up and to right

    Next x

    ​End Module

     

    Visual Basic Code

    Imports System

    Imports Tinkerforge

     

    Module MeasureAltoReed

      Const HOST As String = "localhost"

      Const PORT As Integer = 4223

      Const UIDx As String = "5W5E6E"    ' Change XXYYZZ to the UID of your x direction Stepper Brick

      Const UIDy As String = "67PGPm "    ' Change XXYYZZ to the UID of your y direction Stepper Brick

     

      Sub Main()

          Dim ipconx As New IPConnection()                        ' Create IP connection for x

    ​ Dim ipcony As New IPConnection()                        ' Create IP connection for y

          Dim stepperx As New BrickStepper(UIDx, ipconx)  ' Create device object for x direction stepper

          Dim steppery As New BrickStepper(UIDy, ipcony)  ' Create device object for y direction stepper

     

          ipcon.Connect(HOST, PORT) ' Connect to brickd Don't use device before ipcon is connected

     

          stepperx.SetSpeedRamping(30000, 30000)    '    Set stepper x values

          stepperx.SetMexVelocity(5000)

          stepperx.StepDecay(50000)

          stepperx.Enable()                                              '  Enable x motor power

          stepperx.SetStepMode(4)

     

          steppery.SetSpeedRamping(30000, 30000)    '    Set stepper y values

          steppery.SetMexVelocity(5000)

          steppery.StepDecay(50000)

          steppery.Enable()                                              '  Enable y motor power

          steppery.SetStepMode(4)

     

          Console.WriteLine("Press key to start")

          Console.ReadLine()

     

          Dim currentxpos As Integer = 0

          Dim currentypos As Integer = 82

          Dim distancexaway As Integer

          Dim distanceyaway As Integer

     

    ​ distancexaway = -9 – currentxpos      ​‘ Move to (-9,35) from start (0,82)

    stepperx.SetSteps(distancexaway*800)    ‘ 800 steps = 1 mm

    currentxpos = currentxpos + distancexaway

     

    distanceyaway = 35 – currentypos

    steppery.SetSteps(distanceyaway*800)

    ​ currentypos = currentypos + distanceyaway

     

          For x As Integer = -9 To 9

              distancexaway = x - currentxpos

              stepperx.SetSteps(distancexaway*800)

        currentxpos = currentxpos + distancexaway

     

              For y As Integer = 35 To 73

                  distanceyaway = y - currentypos

              ​  steppery.SetSteps(distanceyaway*800)

            currentypos = currentypos + distanceyaway

     

                  Console.WriteLine("Current position ( x , y ) (" + x.ToString() + ", " + y.ToString() + ")")

     

                  ' Get reed measurement and output

              Next y

          Next x

     

          stepperx.Disable()

          steppery.Disable()

          ipcon.Disconnect()

      End Sub

    End Module

     

     

    Severity

     

    Code

     

    Description

     

    Project

     

    File

     

    Line

     

    Suppression State

     

    Error

     

    BC30002

     

    Type 'IPConnection' is not defined.

     

    MeasuringTollCorr.4

     

    c:\users\boss\documents\visual studio 2015\Projects\MeasuringTollCorr.4\MeasuringTollCorr.4\Module1.vb

     

    13

     

    Active

     

    Error

     

    BC30002

     

    Type 'BrickStepper' is not defined.

     

    MeasuringTollCorr.4

     

    c:\users\boss\documents\visual studio 2015\Projects\MeasuringTollCorr.4\MeasuringTollCorr.4\Module1.vb

     

    14

     

    Active

     

    Error

     

    BC30002

     

    Type 'BrickStepper' is not defined.

     

    MeasuringTollCorr.4

     

    c:\users\boss\documents\visual studio 2015\Projects\MeasuringTollCorr.4\MeasuringTollCorr.4\Module1.vb

     

    15

     

    Active

     

     

×
×
  • Neu erstellen...