Raspberry Pi iBeacon

硬件

  • 树莓派一台
  • 奥睿科 BTA-406-RD USB蓝牙4.0适配器
$ sudo apt-get install libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev
$ mkdir bluez
$ cd bluez
$ wget https://www.kernel.org/pub/linux/bluetooth/bluez-5.15.tar.gz
$ tar xvf bluez-5.15.tar.gz
$ cd bluez-5.15
$ sudo ./configure --disable-systemd
$ sudo make
$ sudo make install
$ hciconfig
hci0:   Type: BR/EDR  Bus: USB
    BD Address: 00:1A:7D:DA:71:0B  ACL MTU: 310:10  SCO MTU: 64:8
    DOWN
    RX bytes:419 acl:0 sco:0 events:133 errors:0
    TX bytes:68 acl:0 sco:0 commands:16 errors:0
$ sudo hciconfig hci0 up
$ hciconfig
hci0:   Type: BR/EDR  Bus: USB
    BD Address: 00:1A:7D:DA:71:0B  ACL MTU: 310:10  SCO MTU: 64:8
    UP RUNNING
    RX bytes:1094 acl:0 sco:0 events:54 errors:0
    TX bytes:768 acl:0 sco:0 commands:54 errors:0
$ sudo hcitool -i hci0 cmd 0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 E2 0A 39 F4 73 F5 4B C4 A1 2F 17 D1 AD 07 A9 62 00 00 00 00 C8 00

UDID: E20A39F4-73F5-4BC4-A12F-17D1AD07A962

参考: http://developer.radiusnetworks.com/2013/10/09/how-to-make-an-ibeacon-out-of-a-raspberry-pi.html

http://learn.adafruit.com/pibeacon-ibeacon-with-a-raspberry-pi?view=all

Raspberry Pi GPIO Blink

Blink is the “Hello World” of the GPIO interfacing world. It’s the simplest program and circuit that lets you see something happening.

$ git clone git://git.drogon.net/wiringPi
$ cd wiringPi
$ ./build
$ vim blink.c
#include 
int main (void)
{
  wiringPiSetup () ;
  pinMode (0, OUTPUT) ;
  for (;;)
  {
    digitalWrite (0, HIGH) ; delay (500) ;
    digitalWrite (0,  LOW) ; delay (500) ;
  }
  return 0 ;
}
</pre>
$ gcc -Wall -o blink blink.c -lwiringPi
$ sudo ./blink

接线方式,这里我使用了GPIO转接板

@pinMode (0, OUTPUT)@ 表示P0这个接口,正极接P0,负极接一个330欧姆的电阻。

参考:http://wiringpi.com/examples/blink/

https://projects.drogon.net/raspberry-pi/wiringpi/pins/

http://hugozhu.myalert.info/2013/03/22/19-raspberry-pi-gpio-port-naming.html

</section>

Unity3D Sprite Click Event

给Sprite加上Box Collider 2D碰撞检测,然后绑定带有OnMouseDown方法的脚本即可。

Apache Ivy

$ brew update
$ brew install ivy
$ mkdir -p ~/.ant/lib
$ cp /usr/local/Cellar/ivy/2.3.0/libexec/ivy-2.3.0.jar ~/.ant/lib
$ mkdir hello-ivy
$ cd hello-ivy

vim ivy.xml


    
    
        
    

vim build.xml


    
        
    

    

$ ant main

git Remove sensitive data

$ git filter-branch --force --index-filter \
  'git rm -r --cached --ignore-unmatch filedir' \
  --prune-empty --tag-name-filter cat -- --all