[#VS2012] HowTo: Find the connected internet IP Address


image

Buenas,

After a couple of minutes searching the internet a Code Snippet that allows me to find out the IP address with which I am connected to the internet, I realized that I don’t actually have to search from my computer to the outside, but from the outside inwards (quiet that I have not yet made anything).

There are many places that when you connect, tell you the IP address with which these emerging Internet, and some are as simple as http://icanhazip.com/ . This site only gives you your IP address, so we can process your output with the following code:

   1: public static string GetInternetIpAddress()
   2: {
   3:     var client = new WebClient();
   4:     var ip = client.DownloadString("http://icanhazip.com/");
   5:     return ip;
   6: }

Simplest impossible!

Disclaimer: there are other ways it, however if these under many levels and layers of IPs addresses, this option is the fastest ;)

 

Saludos @ La Finca

El Bruno

image image image

[#VS2012] HowTo: Conocer la IP con la que sales a internet


image

Buenas,

después de un par de minutos buscando en internet algún Code Snippet que me permita averiguar la dirección IP con la que estoy conectado a internet, me di cuenta que en realidad no tengo que buscar desde mi ordenador hacia afuera, sino desde afuera hacia adentro (tranquilo que todavía no he tomado nada).

Hay muchos sitios que cuando te conectas, te dicen la dirección IP con la que estas saliendo a internet, y algunos son tan simples como http://icanhazip.com/. Este site solo te da tu dirección IP, asi que podemos procesar su output con el siguiente código:

   1: public static string GetInternetIpAddress()

   2: {

   3:     var client = new WebClient();

   4:     var ip = client.DownloadString("http://icanhazip.com/");

   5:     return ip;

   6: }

Más simple imposible !!!

Disclaimer: hay otras formas lo se, sin embargo si estas bajo muchos niveles y capas de direcciones IPs, pues esta opción es la más rápida ;)

 

Saludos @ La Finca

El Bruno

image image image

[#NETMF] HowTo: Crear un sensor de movimientos (II)


image

Buenas

en el post de ayer comenté sobre un accesorio para detectar movimientos utilizando .Net Gadgeteer. Hoy veremos como con un par de líneas de código más, podemos activar la cámara para que en el momento que se detecta movimiento, saque una foto y la muestre en el display gráfico.

Para este ejemplo utilizaremos

 

Con el siguiente diagrama

image

Y luego en el código veremos que

  • - cuando se detecta movimiento se indica a la cámara que saque una foto (línea 21)
  • - cuando la cámara saca una foto, la misma se muestra en el display gráfico
   1: using System;

   2: using GT = Gadgeteer;

   3:  

   4: namespace GadgeteerApp15

   5: {

   6:     public partial class Program

   7:     {

   8:         void ProgramStarted()

   9:         {

  10:             motion_Sensor.Motion_Sensed += MotionSensorMotionSensed;

  11:             camera.PictureCaptured += CameraPictureCaptured;

  12:         }

  13:  

  14:         void CameraPictureCaptured(GT.Modules.GHIElectronics.Camera sender, GT.Picture picture)

  15:         {

  16:             display_T35.SimpleGraphics.DisplayImage(picture, 5, 5);

  17:         }

  18:  

  19:         void MotionSensorMotionSensed(GT.Modules.GHIElectronics.Motion_Sensor sender, GT.Modules.GHIElectronics.Motion_Sensor.Motion_SensorState state)

  20:         {

  21:             camera.TakePicture();

  22:         }

  23:     }

  24: }

En los próximos posts veremos como enviar esta información a un procesador de movimientos, e inclusive … pues como montarlo con un modelo cliente / servidor.

Saludos @ Home

El Bruno

image image image

[#NETMF] HowTo: Crear un sensor de movimientos (I)


image

Buenas

el ejemplo de hoy no intenta reemplazar a un Kinect, ni mucho menos. Sin embargo nos muestra que con un pequeño hardware de poco más de €12, podemos crear un sensor de movimientos que cuando detecte movimientos, comience a grabar el input de una cámara.

Sobre esta base comenzamos con el siguiente hardware para el ejemplo, donde veremos lo simple que puede ser crear un Motion Detector

con estos 3 elementos, conectamos los mismos guiados por el siguiente esquema

 

image

En este punto, con el sensor conectado vemos que el trabajo con el mismo es bastante simple.

La línea 10 nos muestra que tenemos un evento Motion_Sensed() que se activa cuando el sensor detecta movimiento.

   1: using Gadgeteer.Modules.GHIElectronics;

   2: using Microsoft.SPOT;

   3: namespace GadgeteerApp14

   4: {

   5:     public partial class Program

   6:     {

   7:         void ProgramStarted()

   8:         {

   9:             motion_Sensor.Motion_Sensed += MotionSensorMotionSensed;

  10:         }

  11:  

  12:         void MotionSensorMotionSensed(Motion_Sensor sender, Motion_Sensor.Motion_SensorState state)

  13:         {

  14:             Debug.Print("motion detected !");

  15:             // also check >> motion_Sensor.SensorStillActive

  16:         }

  17:     }

  18: }

Pues bien, podemos suscribirnos a este evento o podemos cambiar el enfoque y hacer un PULL del estado del sensor. Para este segundo caso debemos verificar el valor booleano de la propiedad SensorStillActive (línea 15).

El sensor es bastante pequeño y tiene un rango de unos 7 metros según las indicaciones oficiales que podemos leer aquí.

image

En el próximo post, le agregamos una cámara y guardamos el contenido de la misma en una tarjeta SD.

 

Saludos @ Home

El Bruno

image image image

[ELBRUNO] .Net Gadgeteer, HowTo: Mostrar un chart en un display


image

Buenas

Después de 2 días en Paris donde pude escribir poco y aprender mucho; hoy vamos con un ejemplo de código puro y duro

Cómo pintar pixel a pixel un chart en un display con .Net Gadgeteer.

En este ejemplo utilizaremos los siguientes elementos

Organizados con el siguiente esquema:

image

Del código de la aplicación debo resaltar

  • linea 19, en el press del Button además de detener e iniciar el timer, enciendo y apago el LED del boton
  • línea 32, la rutina que dibuja el chart es de lo más simple, incrementa un contador entre 20  40 y luego lo decrementa. También hay un segundo flag para controlar el avance vertical

 

   1: using GT = Gadgeteer;

   2:  

   3: namespace GadgeteerApp6

   4: {

   5:     public partial class Program

   6:     {

   7:         private uint _axisX = 20;

   8:         private uint _axisY = 20;

   9:         private GT.Timer _timer;

  10:         private bool _modeUp = true;

  11:  

  12:         void ProgramStarted()

  13:         {

  14:             button.ButtonPressed += ButtonButtonPressed;

  15:             _timer = new GT.Timer(200);

  16:             _timer.Tick += TimerTick;

  17:         }

  18:  

  19:         void ButtonButtonPressed(GT.Modules.GHIElectronics.Button sender, GT.Modules.GHIElectronics.Button.ButtonState state)

  20:         {

  21:             button.ToggleLED();

  22:             if (_timer.IsRunning)

  23:             {

  24:                 _timer.Stop();

  25:             }

  26:             else

  27:             {

  28:                 _timer.Start();

  29:             }

  30:         }

  31:  

  32:         void TimerTick(GT.Timer timer)

  33:         {

  34:             _axisY++;

  35:             if (_axisY + 10 > display_T35.SimpleGraphics.Height)

  36:             {

  37:                 display_T35.SimpleGraphics.Clear();

  38:                 _axisY = 20;

  39:             }

  40:             if (_modeUp && _axisX > 40)

  41:             {

  42:                 _modeUp = false;

  43:             }

  44:             if (!_modeUp && _axisX < 20)

  45:             {

  46:                 _modeUp = true;

  47:             }

  48:             if (_modeUp)

  49:             {

  50:                 _axisX++;

  51:             }

  52:             else

  53:             {

  54:                 _axisX--;

  55:             }

  56:             display_T35.SimpleGraphics.SetPixel(GT.Color.Green, _axisX, _axisY);

  57:             for (uint i = 1; i < 15; i++)

  58:             {

  59:                 display_T35.SimpleGraphics.SetPixel(GT.Color.Red, _axisX + i, _axisY);

  60:             }

  61:         }

  62:     }

  63: }

Para muestra nada mejor que un video

Y ya mañana para Santa Pola a mostrar estas cositas en vivo con los amigos de GuseNet.

 

Saludos @ Home

El Bruno

image image image

[#NETMF] HowTo: Change the color of a LED with a Timer and a Button


image

Buenas

today’s example is a little more complicated than a Hello World, but you gives more joys. It’s used a button and a multi-color LED to change the color of it with a timer.

In this example we will use

with the following diagram

image

And again, with less than 50 lines of code source we can deploy our application.

   1: using Gadgeteer.Modules.GHIElectronics;

   2: using GT = Gadgeteer;

   3:  

   4: namespace GadgeteerApp5

   5: {

   6:     public partial class Program

   7:     {

   8:         private GT.Timer _timer;

   9:  

  10:         void ProgramStarted()

  11:         {

  12:             button.ButtonPressed += ButtonButtonPressed;

  13:             _timer = new GT.Timer(1000);

  14:             _timer.Tick += TimerTick;

  15:         }

  16:  

  17:         void ButtonButtonPressed(Button sender, Button.ButtonState state)

  18:         {

  19:             if (!_timer.IsRunning)

  20:             {

  21:                 _timer.Start();

  22:             }

  23:             else

  24:             {

  25:                 _timer.Stop();

  26:                 multicolorLed.TurnOff();

  27:             }

  28:         }

  29:  

  30:         private void TimerTick(GT.Timer timer)

  31:         {

  32:             var color = multicolorLed.GetCurrentColor();

  33:  

  34:             if (color == GT.Color.Blue)

  35:             {

  36:                 color = GT.Color.Green;

  37:             }

  38:             else if (color == GT.Color.Green)

  39:             {

  40:                 color = GT.Color.Red;

  41:             }

  42:             else

  43:             {

  44:                 color = GT.Color.Blue;

  45:             }

  46:  

  47:             multicolorLed.TurnColor(color);

  48:         }

  49:     }

  50: }

Interesting application data

  • Line 13, special implementation of timer for.Net Gadgeteer. Or try to use the timer of. Net, you will die between terrible suffering
  • Line 19, in the implementation of the button, the Timer starts and shuts off the LED when the timer is stopped
  • Line 29, shows how simple that is to use LEDs, a GetCurrentColor() to get the current color and then a TurnColor() to set the color of the LED

The video http://www.youtube.com/watch?feature=player_embedded&v=yEwqQTdRc2c

Saludos @ La Finca

El Bruno

image image image

[#NETMF] HowTo: Cambiar el color de un LED con un Timer y un Button


image

Buenas

el ejemplo de hoy es un poco más complicado que un Hello World, pero te dá mas alegrias. Se trata de utilizar un botón y un LED multicolor para cambiar el color del mismo con un timer.

En este ejemplo utilizaremos

con el siguiente diagrama

image

Y de nuevo, con menos de 50 líneas de código fuente podremos implementar nuestra aplicación.

   1: using Gadgeteer.Modules.GHIElectronics;

   2: using GT = Gadgeteer;

   3:  

   4: namespace GadgeteerApp5

   5: {

   6:     public partial class Program

   7:     {

   8:         private GT.Timer _timer;

   9:  

  10:         void ProgramStarted()

  11:         {

  12:             button.ButtonPressed += ButtonButtonPressed;

  13:             _timer = new GT.Timer(1000);

  14:             _timer.Tick += TimerTick;

  15:         }

  16:  

  17:         void ButtonButtonPressed(Button sender, Button.ButtonState state)

  18:         {

  19:             if (!_timer.IsRunning)

  20:             {

  21:                 _timer.Start();

  22:             }

  23:             else

  24:             {

  25:                 _timer.Stop();

  26:                 multicolorLed.TurnOff();

  27:             }

  28:         }

  29:  

  30:         private void TimerTick(GT.Timer timer)

  31:         {

  32:             var color = multicolorLed.GetCurrentColor();

  33:  

  34:             if (color == GT.Color.Blue)

  35:             {

  36:                 color = GT.Color.Green;

  37:             }

  38:             else if (color == GT.Color.Green)

  39:             {

  40:                 color = GT.Color.Red;

  41:             }

  42:             else

  43:             {

  44:                 color = GT.Color.Blue;

  45:             }

  46:  

  47:             multicolorLed.TurnColor(color);

  48:         }

  49:     }

  50: }

Datos interesantes de la aplicación
  • Línea 13, implementación especial de timer para .Net Gadgeteer. Ni intentes utilizar el timer de .Net, morirás entre terribles sufrimientos
  • Línea 19, en la implementación del button, se inicia el Timer y se apaga el LED cuando se detiene el timer
  • Línea 29, demuestra lo simple que es utilizar el LED, un GetCurrentColor() para obtener el color actual y luego un TurnColor() para definir el color del LED

El video a continuación

 

Saludos @ La Finca

El Bruno

image image image

[#NETMF] HowTo: Create a photo camera with 20 lines of code lines (and probably less)


image

Buenas

today a post those good, good, good: how to create a camera using. Net Gadgeteer with 22 lines of code.

In this example we will use the following components:

Connected as shown in the image:

image

Now, for what remains of the post I recommend sitting or take a few whiskitos before… This is the source code of the application.

   1: namespace GTPhotoCamera
   2: {
   3:     public partial class Program
   4:     {
   5:         void ProgramStarted()
   6:         {
   7:             button.ButtonPressed += ButtonButtonPressed;
   8:             camera.PictureCaptured += CameraPictureCaptured;
   9:         }
  10:  
  11:         void CameraPictureCaptured(Gadgeteer.Modules.GHIElectronics.Camera sender, Gadgeteer.Picture picture)
  12:         {
  13:             display_T35.SimpleGraphics.DisplayImage(picture, 5, 5);
  14:         }
  15:  
  16:         void ButtonButtonPressed(Gadgeteer.Modules.GHIElectronics.Button sender, Gadgeteer.Modules.GHIElectronics.Button.ButtonState state)
  17:         {
  18:             camera.TakePicture();
  19:         }
  20:     }
  21: }

Simply impressive! a function to request a picture of the camera, and a function to process the same… simplicity above all ;)

Saludos @ La Finca

El Bruno

image image image

a

[#NETMF] HowTo: Crear una photo camera con 20 source code lines (y menos si eres poco ordenado con tu código)


image

Buenas.

Hoy un post de esos buenos , buenos, buenos: Cómo crear una cámara de fotos utilizando .Net Gadgeteer con 22 líneas de código. En este ejemplo utilizaremos los siguientes componentes:

Conectados como muestra la imagen:

image

Ahora bien, para lo que sigue del post les recomiendo estar sentados o tomarse un par de whiskitos antes … este es el código fuente de la aplicación.

   1: namespace GTPhotoCamera

   2: {

   3:     public partial class Program

   4:     {

   5:         void ProgramStarted()

   6:         {

   7:             button.ButtonPressed += ButtonButtonPressed;

   8:             camera.PictureCaptured += CameraPictureCaptured;

   9:         }

  10:  

  11:         void CameraPictureCaptured(Gadgeteer.Modules.GHIElectronics.Camera sender, Gadgeteer.Picture picture)

  12:         {

  13:             display_T35.SimpleGraphics.DisplayImage(picture, 5, 5);

  14:         }

  15:  

  16:         void ButtonButtonPressed(Gadgeteer.Modules.GHIElectronics.Button sender, Gadgeteer.Modules.GHIElectronics.Button.ButtonState state)

  17:         {

  18:             camera.TakePicture();

  19:         }

  20:     }

  21: }

Simplemente impresionante! una función para solicitar una foto de la cámara, y una función para procesar la misma … la simplicidad ante todo ;)

 

Saludos @ La Finca

El Bruno

image image image

[#TFS] TFS Branch Community Tool, step by step


image

Buenas,

a couple of days ago I wrote a post where commented on the launch of the TFS Community Branch Tool , an extension for Visual Studio, 2012, allowing us to create structures of Branches in a quick way and following the guidelines proposed by the ALM Rangers in theirVisual Studio Team Foundation Server Branching & Merging Guide . As well, today a step by step on how to use it:

1. Download the extension from http://visualstudiogallery.msdn.microsoft.com/ce9651af-671c-4148-987f-a91820646031?SRC=Home

2 Install the extension

image

3 Login to TFS and see the Source Control Explorer

4 Select a branch or root of a Team Project and display the contextual menu

5. Select the option “Tfs Community Branch Tool / / Apply initial structure”

image

6. At the moment appears a wizard that shows 3 options for the creation of a scheme of branches, basic features and only the MAIN branch.

image

7 After a few seconds the Wizard ends execution of the steps.

image

8 Of this we have the structure of folders available to work.

image

Saludos @ Home

El Bruno

image image image