<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Punksolid &#187; blueooth</title>
	<atom:link href="http://www.punksolid.com/tag/blueooth/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.punksolid.com</link>
	<description>Tecnologia, Curiosidades, Sistemas de Informacion y un poco de Religion</description>
	<lastBuildDate>Thu, 18 Aug 2011 13:06:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Encendido de LED por Proximidad por Bluetooth</title>
		<link>http://www.punksolid.com/apertura-de-puertas-por-proximidad-por-bluetooth/2008/</link>
		<comments>http://www.punksolid.com/apertura-de-puertas-por-proximidad-por-bluetooth/2008/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 08:16:22 +0000</pubDate>
		<dc:creator>Punksolid</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[programación]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[blueooth]]></category>

		<guid isPermaLink="false">http://www.punksolid.com/?p=183</guid>
		<description><![CDATA[He hecho un proyecto para la escuela que consiste en abrir los seguros del carro al estar cerca de él, y de cerrarlos al alejarse, es solo un prototipo, para eso he utilizado un Arduino, un USB-Bluetooth, una laptop y el celular que se va a detectar. Video demo Todo está hecho sobre linux UBUNTU [...]]]></description>
			<content:encoded><![CDATA[<p>He hecho un proyecto para la escuela que consiste en abrir los seguros del carro al estar cerca de él, y de cerrarlos al alejarse, es solo un prototipo, para eso he utilizado un Arduino, un USB-Bluetooth, una laptop y el celular que se va a detectar.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/ECcawVaYyAY&amp;hl=es&amp;fs=1" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/ECcawVaYyAY&amp;hl=es&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Video demo</p>
<p>Todo está hecho sobre linux UBUNTU 8.10, sobre windows no se me ocurre como integralo, solo haciendo una sola aplicacion completa.</p>
<p>1.- Se ensambla e USB-Bluetooth a la computadora y se empareja el dispositivo por medio de los asistentes.</p>
<p>2.- Se instala la aplicación Blueproximity desde Synaptics y se configura.</p>
<p>3.- Se baja una clase en C que tiene funciones para el manejo del puerto serial, la clase es <a href="http://todbot.com/arduino/host/arduino-serial/arduino-serial.c">arduino-serial.c</a>, al descargar accesas a la carpeta donde lo descargaste y desde la terminal ejecutas</p>
<blockquote><p><code>punksolid$ gcc -o arduino-serial arduino-serial.c</code></p></blockquote>
<p>con eso compilas la clase, para su uso solo basta</p>
<blockquote><p><code>punksolid$ ./arduino-serial</code></p></blockquote>
<p>y aparecerá el modo de uso, por ejemplo yo uso está linea para encender el led</p>
<blockquote><p>punksolid$ /home/punksolid/arduino-serial -b 19200 -p /dev/ttyUSB0 -s m</p></blockquote>
<p>y para apagarlo</p>
<blockquote><p>punksolid$ /home/punksolid/arduino-serial -b 19200 -p /dev/ttyUSB0 -s n</p></blockquote>
<p>el codigo de la placa arduino es el siguiente</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"> <span style="color: #339933;">*</span> Serial Read Blink
 <span style="color: #339933;">*</span> <span style="color: #339933;">-----------------</span>
 <span style="color: #339933;">*</span> Turns on and off a light emitting diode<span style="color: #009900;">&#40;</span>LED<span style="color: #009900;">&#41;</span> connected to digital
 <span style="color: #339933;">*</span> pin <span style="color: #0000dd;">13</span>. <span style="color: #202020;">The</span> LED will blink the number of times given by a
 <span style="color: #339933;">*</span> single<span style="color: #339933;">-</span>digit ASCII number read from the serial port.
 <span style="color: #339933;">*</span>
 <span style="color: #339933;">*</span> Created <span style="color: #0000dd;">18</span> October <span style="color: #0000dd;">2006</span>
 <span style="color: #339933;">*</span> copyleft <span style="color: #0000dd;">2006</span> Tod E. <span style="color: #202020;">Kurt</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>tod@todbot.<span style="color: #202020;">com</span><span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>
 <span style="color: #339933;">*</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//todbot.com/</span>
 <span style="color: #339933;">*</span>
 <span style="color: #339933;">*</span> based on <span style="color: #ff0000;">&quot;serial_read_advanced&quot;</span> example
 <span style="color: #339933;">*/</span>
&nbsp;
<span style="color: #993333;">int</span> ledPin <span style="color: #339933;">=</span> <span style="color: #0000dd;">13</span><span style="color: #339933;">;</span>   <span style="color: #666666; font-style: italic;">// select the pin for the LED</span>
<span style="color: #993333;">int</span> val <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>       <span style="color: #666666; font-style: italic;">// variable to store the data from the serial port</span>
&nbsp;
<span style="color: #993333;">void</span> setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  pinMode<span style="color: #009900;">&#40;</span>ledPin<span style="color: #339933;">,</span>OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    <span style="color: #666666; font-style: italic;">// declare the LED's pin as output</span>
  Serial.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">19200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>        <span style="color: #666666; font-style: italic;">// connect to the serial port</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> loop <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  val <span style="color: #339933;">=</span> Serial.<span style="color: #202020;">read</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>      <span style="color: #666666; font-style: italic;">// read the serial port</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// if the stored value is a single-digit number, blink the LED that number</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>val <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #ff0000;">'0'</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> val <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;=</span> <span style="color: #ff0000;">'9'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    val <span style="color: #339933;">=</span> val <span style="color: #339933;">-</span> <span style="color: #ff0000;">'0'</span><span style="color: #339933;">;</span>          <span style="color: #666666; font-style: italic;">// convert from character to number</span>
    <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>val<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      Serial.<span style="color: #202020;">println</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;blink!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      digitalWrite<span style="color: #009900;">&#40;</span>ledPin<span style="color: #339933;">,</span>HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">150</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      digitalWrite<span style="color: #009900;">&#40;</span>ledPin<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">150</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #666666; font-style: italic;">//Serial.println();</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>val<span style="color: #339933;">==</span><span style="color: #ff0000;">'m'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      digitalWrite<span style="color: #009900;">&#40;</span>ledPin<span style="color: #339933;">,</span>HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>val<span style="color: #339933;">==</span><span style="color: #ff0000;">'n'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      digitalWrite<span style="color: #009900;">&#40;</span>ledPin<span style="color: #339933;">,</span>LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>4.- Ya nada mas falta configurar Blueproximity en la pestaña de bloqueo para que se ejecute el comando de ejemplo que puse arriba.</p>
<p>Como utilidades he pensado en la apertura de serguros electricos para carro al acercarse ademas tambien bajar las ventanas, y viceversa para cuando el usuario se aleje, para hacer eso basta con un relay.</p>
<p>Cualquier duda comentarlo y responderé.</p>
<p>Referencias</p>
<p>Conectar <a href="http://todbot.com/blog/2006/12/06/arduino-serial-c-code-to-talk-to-arduino/">Arduino con el lenguaje C</a></p>
<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://www.punksolid.com/apertura-de-puertas-por-proximidad-por-bluetooth/2008/&via=Punksolid&text=Encendido de LED por Proximidad por Bluetooth&related=José Palazuelos:&lang=en&count=horizontal" class="twitter-share-button">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://www.punksolid.com/apertura-de-puertas-por-proximidad-por-bluetooth/2008/&via=Punksolid&text=Encendido de LED por Proximidad por Bluetooth&related=José Palazuelos:&lang=en&count=horizontal" class="twitter-share-button">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.punksolid.com/apertura-de-puertas-por-proximidad-por-bluetooth/2008/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

