2010-07-18

パパっと Apple wireless keyboard を掃除する

キーボードがだいぶ汚れてしまっていたので、掃除しようと思い立つ。
下の写真のような感じで、かなり汚い。
黒いとわからないけど、白だとすごく目立つ。

掃除前のApple wireless keyboard
掃除前のApple wireless keyboard posted by (C)matty

ちょっと調べてみると、キーを全部外してがんばっている人を発見。まあ、ここまでやる気はないのでパス。
Apple Wireless Keyboardを掃除する (In Digital World!)

キーの汚れを掃除している人を発見。エタノールと綿棒を使う方法。なるほど。良さそうかも。
Apple Wireless Keyboard の掃除 (mouseLoop)

ということで、綿棒でちょこちょこやっていましたが、キーを2,3個きれいにした段階で、とにかくめんどくさいと思ってしまいました。

そこで、綿棒の代わりにキッチンペーパーを使って、全体を一気に掃除することにしたらあら簡単。あっという間にきれいになりました。

まとめ:
エタノールの代わりにアルコール系の消毒液を使用。
ティッシュでもいけると思いますが、
ぼろぼろとカスが出るのでもう少し強度があった方がよいと思います。
僕はキッチンペーパーを使いました。

掃除道具
掃除道具 posted by (C)matty

30秒くらいさっと拭けばこんな感じ。
きれい。キーを打つ感覚も新品のときのような感触に戻りました。

掃除後のApple wireless keyboard
掃除後のApple wireless keyboard posted by (C)matty

水拭きするのは抵抗があるけど、これならすぐ乾くしいいですね。
キーボードについている汚れも結局手についていた汚れですから、
手洗い用の消毒液を使うのはいい感じかも。

今までアルコールの消毒薬をあまり使いたくなかったのだけど、
水よりもさっぱりしてよいかもしれない。

[Japanino] Japanino と Wii リモコンで、ネットワークランプ

久々にやる気が出たので、ネットワークランプを作ってみた。
ブレッドボードにプスプスやるのは学生のとき以来だなぁ。



ネットワークランプ自体の作り方は、「Arduinoをはじめよう」を参照してください。

変更点は、RGBの値の設定をフィード中のキーワードの数ではなく、Wiiリモコンから変更できるようにしたことです。

Processingを使って作成しました。ProcessingでWiiリモコンを接続するために使うライブラリ(wrj4P5)の使い方は、WiiリモコンとP5を参考にしました。

Arduino側のスケッチはほとんど変更していません。変更なしでもOKです。たまに青いLEDが光るので、それをなくしたかったのだけど、よくわからなかった。

ブレッドボード上の回路は本に載っているものそのままです。
こんな感じ。

Arduino (Japanino) network lamp
Arduino (Japanino) network lamp posted by (C)matty

動作の説明(Wiiリモコンの操作方法):
2ボタンを押すと、REDのLEDが明るくなる。
1ボタンを押すと、REDのLEDが暗くなる。
Rightボタンを押すと、3つのLEDの明るさを右にシフトする。
Leftボタンを押すと、3つのLEDの明るさを左にシフトする。
Homeボタンを押すと、すべての明るさを0にリセットする。

オリジナルのソースコードはココ Networked Lamp Example Code



Processingのソースを置いておきますのでやってみたい方はお試しください。


import processing.serial.*;
import lll.wrj4P5.*;

Wrj4P5 wii;

int interval = 10; // retrieve feed every 60 seconds;
int lastTime; // the last time we fetched the content

int LED_red = 0;
int LED_green = 0;
int LED_blue = 0;

int light = 0; // light level measured by the lamp

Serial port;
color c;
String cs;

String buffer = ""; // Accumulates characters coming from arduino

PFont font;

void setup() {
size(640,480);
frameRate(2); // we don't need fast updates

font = loadFont("HelveticaNeue-Bold-32.vlw");
fill(255);
textFont(font, 32);
// IMPORTANT NOTE:
// The first serial port retrieved by Serial.list()
// should be your arduino. If not, uncomment the next
// line by deleting the // before it, and re-run the
// sketch to see a list of serial ports. Then, change
// the 0 in between [ and ] to the number of the port
// that your arduino is connected to.
//println(Serial.list());
String arduinoPort = Serial.list()[0];
port = new Serial(this, arduinoPort, 9600); // connect to arduino

lastTime = 0;

// Wiiリモコンの設定
wii=new Wrj4P5(this);
wii.connect();
}

void buttonPressed(RimokonEvent evt, int rid) {
if (evt.wasPressed(RimokonEvent.TWO))
{
println("2");
LED_red += 16;
}
if (evt.wasPressed(RimokonEvent.ONE))
{
println("1");
LED_red -= 16;
}
if (evt.wasPressed(RimokonEvent.B)) println("B");
if (evt.wasPressed(RimokonEvent.A)) println("A");
if (evt.wasPressed(RimokonEvent.MINUS)) println("Minus");
if (evt.wasPressed(RimokonEvent.HOME))
{ // 値をリセット
println("Home");
LED_red = 0;
LED_green = 0;
LED_blue = 0;
}
if (evt.wasPressed(RimokonEvent.LEFT))
{
println("Left");

int tmp = LED_red;
LED_red = LED_green;
LED_green = LED_blue;
LED_blue = tmp;
}
if (evt.wasPressed(RimokonEvent.RIGHT))
{
println("Right");

int tmp = LED_blue;
LED_blue = LED_green;
LED_green = LED_red;
LED_red = tmp;
}
if (evt.wasPressed(RimokonEvent.DOWN)) println("Down");
if (evt.wasPressed(RimokonEvent.UP)) println("Up");
if (evt.wasPressed(RimokonEvent.PLUS)) println("Plus");
}

void draw() {
background( c );
int n = (interval - ((millis()-lastTime)/1000));

// Build a colour based on the 3 values
c = color(LED_red, LED_green, LED_blue);
cs = "#" + hex(c,6); // Prepare a string to be sent to arduino

text("Japanino Wii Remote Lamp", 10,40);

// Wiiリモコンとの接続が完了したら画面で知らせる
if(false != wii.rimokon.isConnected())
{
text("Wii Remote is connected !", 10, 100);
}

text("Next update in "+ n + " seconds",10,450);
// text("mac" ,10,200);
text("R " ,10,200);
text(" " + LED_red, 130, 200);
rect(200,172, LED_red, 28);

text("G ",10,240);
text(" " + LED_green, 130, 240);
rect(200,212, LED_green, 28);

text("B" ,10,280);
text(" " + LED_blue, 130, 280);
rect(200,252, LED_blue, 28);

// write the colour string to the screen
text("sending", 10, 340);
text(cs, 200,340);

text("light level", 10, 380);
rect(200, 352,light/10.23,28); // this turns 1023 into 100

if (n <= 0) {
lastTime = millis();
}

port.write(cs); // send data to arduino

if (port.available() > 0) { // check if there is data waiting
int inByte = port.read(); // read one byte
if (inByte != 10) { // if byte is not newline
buffer = buffer + char(inByte); // just add it to the buffer
}
else {

// newline reached, let's process the data
if (buffer.length() > 1) { // make sure there is enough data

// chop off the last character, it's a carriage return
// (a carriage return is the character at the end of a
// line of text)
buffer = buffer.substring(0,buffer.length() -1);

// turn the buffer from string into an integer number
light = int(buffer);

// clean the buffer for the next read cycle
buffer = "";

// We're likely falling behind in taking readings
// from arduino. So let's clear the backlog of
// incoming sensor readings so the next reading is
// up-to-date.
port.clear();
}
}
}

}

2010-07-11

Mac mini 購入

Mac mini が来た
Mac mini が来た posted by (C)matty

Windwosマシンが壊れて以来、Mac mini 一台で凌いでいましたが、新しい Mac mini が出たということで2台目を買ってしまいました。インターネットでいろいろできないととても困るので、パソコンも2台あると安心。

かなり薄くなった Mac mini
かなり薄くなった Mac mini posted by (C)matty

一番下のやつが PowerPCの初代 Mac mini。電源ボタンを押しても何も反応がないので、ただの置物です。

真ん中の薄いやつが今回買った新しいモデル。半分とはいかないけどかなり薄くなっています、上から見た面積は一回り大きくなっている。裏蓋がネジなしで外せるようになっていて、メモリの交換が簡単になっているらしい。

一番上のは Intel Core の Mac mini。なんとか使っているけど、CD/DVDドライブの調子が悪い。サーバ/実験用にしようかな。TigerからSnow Leopardまでアップグレードして使っていて設定とかぐちゃぐちゃしているので、必要なデータだけバックアップしてOSインストールし直そうと思います。



とりあえず入れたソフト Memo:
Chicken of the VNC
Launchbar
Firefox (Add-on)
-(Download statusbar)
-(FireGestures)
-(xmarks)
-(imacros)
-(Gmail manager)

Evernote
Dropbox
Growl
Galapagos Reader
xmarks for safari
VLC
Picasa
Pastor

iWork '09

気が向いたらまとめます。