Controlling Servo Motor

Servo Sample Connectivity

In this blog post, I’ll show you how to control a servo motor with a UWP App installed on a Raspberry Pi 2, running Windows 10 IoT Core.

Step One:

You need to connect your Servo Motor to the Raspberry Pi 2 as show in scheme:

Servo Sample Scheme

Step Two:

Now, you should write the code that will control the servo motor, you will find the source code HERE
Clone this code, and you will find two methods: PWM_R() which will make the servo motor rotate to the right and PWM_L() which will make the servo motor rotate to the left.

and you’ll find also the event handler which will be invoked each time you press the push button.

 

And here’s a video of the result you should get:

Advertisements

Get your App Package Family Name

In this blog, i’ll show you how to get you App PackageFamilyName in Windows 10 in C# Code without Store, because it’s not available yet for Windows 10 

Before:

In Windows and Windows Phone, we used to get App PackageFamilyName from the Store by “Associating the App, and get the unique PFN of the App”

Why do i need PFN:

If you are intending to use communication between Apps, or using App Services, you’ll absolutely need the PFN to connect the App and Service you are using or whatever the scenario you are building.

Let’s Get Started:

  1. Open Visual Studio 2015 CTP, Create new project, select Windows 10 (Blank Template)
  2. Open MainPage.xaml.cs and these namespaces.
    using Windows.ApplicationModel;
    using Windows.UI.Popups;
    

    The first, because we will be using a class inside it called Package
    and the second, to show MessageDialog.

  3. Then, in Public MainPage() add this code.
    var currentPack = Package.Current;
    var pfn = currentPack.Id.FamilyName;
    new MessageDialog("PFN = " + pfn).ShowAsync();
    

    This code to show the PFN in a Message Dialog using Package Class.

  4. Now, run the demo, and the PFN should appear in a Message Dialog as shown:
    pfn

Now, you have got your App PFN, you can use it to connect to other App using App Services.
Here’s the Code Sample.
Feel free to contact me, if you face any problem.

Integrating Cortana | Part 3

Cortana

In the two previous blog posts, you should be finished of the first two steps of integrating Cortana.

So, in this blog post, you will perform the last step of integrating Cortana and the most important one which is How to Handle the voice commands.

What we did in the two past blog posts is:

  1. We Created the VCD file which contains the Voice Commands Which the user should say to Cortana.
  2. Then, we registered this VCD file on App Startup to let the System/Cortana recognize which command is activated by the user later.

And Now, we will walk through How to Handle the Voice Command when the user Activate it by saying it to Cortana,  in other words, What the action should be performed when the user say a specific Command. Continue reading

01 Overview

In this post we’re going to have an Overview on C# then later we will start the Technical parts of C# so let’s start 🙂

C# is a modern, general-purpose, object-oriented programming language developed by Microsoft and approved by Ecma and ISO.

C# was developed by Anders Hejlsberg and his team during the development of .Net Framework.

C# is designed for Common Language Infrastructure (CLI), which consists of the executable code and runtime environment that allows use of various high-level languages to be used on different computer platforms and architectures.

The following reasons make C# a widely used professional language:

  • Modern, general-purpose programming language
  • Object oriented.
  • Component oriented.
  • Easy to learn.
  • Structured language.
  • It produces efficient programs.
  • It can be compiled on a variety of computer platforms.
  • Part of .Net Framework.

Strong Programming Features of C#

Although C# constructs closely follow traditional high-level languages, C and C++ and being an object-oriented programming language, it has strong resemblance with Java, it has numerous strong programming features that make it endearing to multitude of programmers worldwide.

Following is the list of few important features:

  • Boolean Conditions
  • Automatic Garbage Collection
  • Standard Library
  • Assembly Versioning
  • Indexers
  • Integration with Windows

Next time we are going to talk about the Environment of C# and the .NET Framwork
Stay Tuned 🙂