Course 10 / Lecture 2:

Send messages from your C#.Net App to your Lego robot

In this lecture you will learn how to send a message to control your Lego robot from your C#.Net app. You will learn how to send control messages to motors, and how to handle user interface events.

Task #1:

Install the lego connection!

To be able to control your Lego robot with your Ozeki 10 software, first you need to pair it with your Windows PC through a bluteooth device under the Bluetooth & Other devices menu of the Control panel in Windows. After you have successfully paired them, open your Ozeki 10 software and in the Control Panel app select the Sensor and the Lego menus and select the COM port of your Lego device. If everything goes well, you can see the robot, its sensors and devices in the list.

Task #2:

Test the lego motors with text messages!

It is possible to control the motor of the Lego robot by sending chat messages to the motor connection. First select the Motor_1@localhost connection. The chat window will appear where you can send different kind of messages to the motor. The help keyword shows you the messsages that can be sent to the motor connection.

Task #3:

Create a global reference for your HelloWorld app!

To control your robot using your C#.NET app, you need to create a global reference for your app. The following video shows you how to perform this.

Task #4:

Create a page with control buttons!

In the end of this lecture we will be able to control your robot with your C# app. The following video shows you how to create OzGPC_Submit buttons that will move the robot into different directions.

Task #5:

Send messages when buttons are pressed!

In the last video of the lecture you can see how to subscribe for the OnClick event of an OzGPC_Submit button. You will learn how to send a message out through the Out method of the previously created HelloWorldStarter.AppInstance. At the end of the video you will see that the Lego robot is moving if you press a controller button and different log entries appear in the log of the motor connection.

More information


Copyright © 2000- |Ozeki Ltd | |
Page: 6159 | | Login
Thank you for visiting this page