04. Bluetooth config file.
# cat /data/misc/bluetooth/bt_config.xml
03. Get Bluetooth MAC.
# adb shell settings get secure bluetooth_address
or # settings get secure bluetooth_address
or # service call bluetooth_manager 10 (10 for Android 4, and 12 for Android 5)
02. Get Bluetooth connection via ADB.
# adb shell am start -a android.bluetooth.adapter.action.STATE_CHANGED
01- Turn ON/OFF Bluetooth via ADB.
Turn ON Bluetooth way 1.
step-1
# am start -a android.bluetooth.adapter.action.REQUEST_ENABLE
(but it required user to accept a dialog)
step-2 (dialog pop-up)
# input keyevent 22 & input keyevent 22
step-3
# input keyevent 23
Turn ON Bluetooth way 2.
# service call bluetooth_manager 6
(and no any accept dialog)
Turn OFF Bluetooth.
# service call bluetooth_manager 8
2016-12-28
Pi, CLI Audio.
Link reference 1: https://www.raspberrypi.org/documentation/configuration/audio-config.md
Link reference 2: https://www.raspberrypi.org/documentation/usage/audio/
Switch audio output.
# amixer cset numid = 2 (2 is HDMI, 1 is Headphone jack, 0 is automatic by default )
Audio player.
# omxplayer example.mp3
# omxplayer -o hdmi example.mp3 (force output over HDMI)
# omxplayer -o local example.mp3 (force output over headphone jack)
Repeat playback
============
# omxplayer --loop example.mp3
[ Sys Reply ]
Audio codec mp3 channels 1 samplerate 11025 bitspersample 16
Subtitle count: 0, state: off, index: 1, delay: 0
Seek to: 00:00:00
Seek to: 00:00:00
Seek to: 00:00:00
[Ctrl + C] Quit player.
Link reference 2: https://www.raspberrypi.org/documentation/usage/audio/
Switch audio output.
# amixer cset numid = 2 (2 is HDMI, 1 is Headphone jack, 0 is automatic by default )
Audio player.
# omxplayer example.mp3
# omxplayer -o hdmi example.mp3 (force output over HDMI)
# omxplayer -o local example.mp3 (force output over headphone jack)
Repeat playback
============
# omxplayer --loop example.mp3
[ Sys Reply ]
Audio codec mp3 channels 1 samplerate 11025 bitspersample 16
Subtitle count: 0, state: off, index: 1, delay: 0
Seek to: 00:00:00
Seek to: 00:00:00
Seek to: 00:00:00
[Ctrl + C] Quit player.
2016-12-15
Arduino, RGB sensor TCS34725.
Required library Adafruit_TCS34725.
Turn Off embedded LED, wired TCS34725 of LED pin to Arduino of GND pin.
2016-11-24
Arduino, Light Sensor.
#include
IRsend irsend;
void setup()
{
Serial.begin(115200);
pinMode (A0, INPUT);
pinMode (13, OUTPUT);
}
void loop()
{
while (Serial.available() == 0);
int pr = analogRead(A0);
int val = Serial.read();
if (val == 81) {
irsend.sendNEC( 0x1067A857, 32 );
Serial.println( "NeoSaid: Received Q." );
} else if (val == 87) {
irsend.sendNEC( 0x1067A857, 32 );
Serial.println( "NeoSaid: Received W." );
} else if (val == 69) {
Serial.println(pr);
if (pr > 700) {
Serial.println( "NeoSaid: Light Up." );
} else {
Serial.println( "NeoSaid: Light Down." );
}
Serial.println( "NeoSaid: Received E." );
} else {
Serial.println( "NeoSaid: Nothing found!!!" );
}
//Serial.println(val);
}
2016-11-21
2016-11-09
2016-11-01
Arduino, LED
int ledPin_Red = 12;
int ledPin_Green = 11;
int ledPin_Yellow = 10;
void setup()
{
pinMode(ledPin_Red, OUTPUT);
pinMode(ledPin_Green, OUTPUT);
pinMode(ledPin_Yellow, OUTPUT);
}
void loop()
{
digitalWrite(ledPin_Red, HIGH);
delay(100);
digitalWrite(ledPin_Green, HIGH);
delay(100);
digitalWrite(ledPin_Yellow, HIGH);
delay(100);
digitalWrite(ledPin_Red, LOW);
delay(100);
digitalWrite(ledPin_Green, LOW);
delay(100);
digitalWrite(ledPin_Yellow, LOW);
delay(100);
}
2016-10-21
2016-10-20
2016-10-18
2016-05-17
Copy IR signal through Audio Editor.
Audio wave editor: Audacity (freeware)
A. Record IR
Config: 選擇正確麥克風輸入 --> (Mono) Record --> 麥克風聲音調至最大 --> 採樣率拉高一點 (預設 384000 is OK).
B. 複製一段 IR signal 做為待會新的正弦波參考用.
Operation 1: 軌道 ==> 新增 ==> Mono track
Operation 2: 開啟新軌道後, 下拉左邊音訊軌道 ==> Format 32bits ==> Rate 76,000Hz
D. 新增軌道3, 複製軌道2過來, 選擇 "效果" ==> "倒轉" 產生一個波形與軌道2相反的正弦波.
E. 合併兩個軌道 (2&3)
Operation: 於軌道2, 選擇 "音訊軌道" ==> "製作立體聲軌道"
A. Record IR
Config: 選擇正確麥克風輸入 --> (Mono) Record --> 麥克風聲音調至最大 --> 採樣率拉高一點 (預設 384000 is OK).
B. 複製一段 IR signal 做為待會新的正弦波參考用.
Operation 1: 軌道 ==> 新增 ==> Mono track
Operation 2: 開啟新軌道後, 下拉左邊音訊軌道 ==> Format 32bits ==> Rate 76,000Hz
D. 新增軌道3, 複製軌道2過來, 選擇 "效果" ==> "倒轉" 產生一個波形與軌道2相反的正弦波.
E. 合併兩個軌道 (2&3)
Operation: 於軌道2, 選擇 "音訊軌道" ==> "製作立體聲軌道"
2016-04-21
Andriod one two three
1. Capture screenshot through shell command.
# screencap -p /sdcard/screen.png
2. am [Activity Manager]
==> Active default browser and go to "google" directly.
# am start -a android.intent.action.VIEW -d http://www.google.com
==> Active Gallery3d to play movie file.
# am start -n com.android.gallery3d/.app.MovieActivity -d file:////sdcard/Movies//movie.ts
==> Open a JPEG file.
# am start -a android.intent.action.VIEW -d file:////data/worktmp//taiwan.jpg -t image/jpeg
==> Play a MP3 file.
# am start -a android.intent.action.VIEW -d file:///data/worktmp/1kTone.mp3 -t audio/mp3
3. Shutdown
# reboot -p
-p: power off
# busybox poweroff
# am start -a android.intent.action.ACTION_REQUEST_SHUTDOWN --ez KEY_CONFIRM true --activity-clear-task
4. Reset to factory default.
# am broadcast -a android.intent.action.MASTER_CLEAR
# screencap -p /sdcard/screen.png
2. am [Activity Manager]
==> Active default browser and go to "google" directly.
# am start -a android.intent.action.VIEW -d http://www.google.com
==> Active Gallery3d to play movie file.
# am start -n com.android.gallery3d/.app.MovieActivity -d file:////sdcard/Movies//movie.ts
==> Open a JPEG file.
# am start -a android.intent.action.VIEW -d file:////data/worktmp//taiwan.jpg -t image/jpeg
==> Play a MP3 file.
# am start -a android.intent.action.VIEW -d file:///data/worktmp/1kTone.mp3 -t audio/mp3
3. Shutdown
# reboot -p
-p: power off
# busybox poweroff
# am start -a android.intent.action.ACTION_REQUEST_SHUTDOWN --ez KEY_CONFIRM true --activity-clear-task
4. Reset to factory default.
# am broadcast -a android.intent.action.MASTER_CLEAR
2016-03-17
LIRC, IR Transmitter [ irsend ]
Schematic (with Raspberry Pi)
(yellow, 3.5mm middle) PIN 17 [3.3V] ==> + IR LED - ==> [GND] PIN 06 (black, 3.5mm peak)
# irsend SEND_ONCE SHM38K KEY_OK
(yellow, 3.5mm middle) PIN 17 [3.3V] ==> + IR LED - ==> [GND] PIN 06 (black, 3.5mm peak)
IRSEND OPTION
-- Help
-h --help display usage summary
-v --version display version
-d --device use given lircd socket [/var/run/lirc/lircd]
-a --address host[:port] connect to lircd at this address
-# --count n send command n times
-- DIRECTIVE can be:
SEND_ONCE - send CODE [CODE...] once
SEND_START - start repeating [CODE]
SEND_STOP - stop repeating [CODE]
LIST - list configured remote items
SET_TRANSMITTERS - set transmitters NUM [NUM...]
SIMULATE - simulate IR event
2016-03-16
Pi, IR Receiver
GROUND ----------------------- IR receiver ( from left Pin-02)
GPIO-18 (Pin-12) -------------- IR receiver ( from left Pin-01)
GPIO-18 (Pin-12) -------------- IR receiver ( from left Pin-01)
2016-03-15
Linux, oneTwoThree
001- tar.bz2
tar jxvf filename.tar.bz2
002- USB-to-Serial ==> CentOS-5.5 not support HL-340 driver by default. Suggest to used PL2303.
# lsusb
# dmesg
003- Find the path.
# whereis wish
wish: /usr/bin/wish8.5
004- dmesg
002- USB-to-Serial ==> CentOS-5.5 not support HL-340 driver by default. Suggest to used PL2303.
# dmesg
003- Find the path.
wish: /usr/bin/wish8.5
# dmesg | more ==> Show event by pages.
# dmesg -c ==> clear previous event.
005- kill (find out process id and then kill)
# kill -9 $( ps -ef | grep wdt | awk '{ print $2 }')
006- pgrep & pkill (list process name & kill)
# pgrep -l [process name]
# pkill [process name]
005- kill (find out process id and then kill)
# kill -9 $( ps -ef | grep wdt | awk '{ print $2 }')
006- pgrep & pkill (list process name & kill)
# pgrep -l [process name]
# pkill [process name]
2016-03-11
Pi, NFS server
NFS server (ip 10.1.1.16)
# apt-get install nfs-kernel-server nfs-common
# vim /etc/exports
/var/tmp *(ro,sync)
# /etc/init.d/nfs-kernel-server stop
# rpcbind
# /etc/init.d/nfs-kernel-server start
# vim /etc/exports
/var/tmp *(ro,sync)
# /etc/init.d/nfs-kernel-server stop
# rpcbind
# /etc/init.d/nfs-kernel-server start
2016-02-19
2016-01-29
2016-01-07
訂閱:
文章 (Atom)