View Single Post
  #5   Spotlight this post!  
Unread 17-03-2009, 23:22
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: sending/Reading the Eathernet port

Here is some code I just wrote. I haven't tested it, but it should display any printed or error strings which are written to the dashboard from the robot.

I've committed this to the Codeplex repo if you want the project file.

Hopefully you find it useful.

Code:
Imports EHaskins.Frc.Dashboard

Module Module1

    Sub Main()
        Dim dashboard As New DashboardClient(Of DefaultUserDataProcessor)
        dashboard.BeginUpdating()

        Dim lastIndex As Integer
        Dim printedLength As Integer
        Dim errorLength As Integer

        Do
            Dim data = dashboard.UserData
            If data IsNot Nothing AndAlso _
                Not lastIndex = data.PacketNumber Then

                'Write new printed strings
                If data.PrintedStrings.Count > printedLength Then
                    For i = printedLength To data.PrintedStrings.Count() - 1
                        Console.WriteLine(data.PrintedStrings(i))
                    Next
                    printedLength = data.PrintedStrings.Count()
                End If

                'Write new error strings
                If data.ErrorStrings.Count > errorLength Then
                    For i = errorLength To data.ErrorStrings.Count() - 1
                        Dim oldColor = Console.ForegroundColor
                        Console.ForegroundColor = ConsoleColor.Red

                        Console.WriteLine(data.ErrorStrings(i))

                        Console.ForegroundColor = oldColor
                    Next
                    errorLength = data.ErrorStrings.Count()
                End If
            End If

            Threading.Thread.Sleep(10) 'Give the CPU a break. :)
        Loop

    End Sub

End Module
__________________
Eric Haskins KC9JVH