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.
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.
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.
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.
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.
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.
- Become a Robot Master
- Build your first App in C#.Net
- Receive messages from your robot and handle events
- Convert a SNAP app into C#
- Build a user interface for multiple robots
- Create a C#.Net version of the Barrier Control App
- Build a responsive user interface for various screen sizes
- Create a data class
- Learn to use an item manager
- Automatically generated grids and forms