2015年6月29日月曜日

CentOS7でのネットワークインストール時のURL

http://ftp.riken.jp/Linux/centos/7/os/x86_64/


UbuntuのウィンドウマネージャをUnityからgnome3に変更する

以下環境情報
Description:    Ubuntu 15.04

コマンド
sudo apt-get dist-upgrade
sudo add-apt-repository ppa:gnome3-team/gnome3 
sudo apt-get update
sudo apt-get install gnome-shell

上記をコンソールへ順に入力してください。

再起動後、ログイン画面で設定を変更すれば、gnomeでログインできます。

Ubuntuでターミナルを開くショートカットキー

Ubuntuでターミナルを開くショートカットキー

Ctrl+Alt+t

Ubuntu 15.04で確認。
試してないけど他のバージョンでも動くと思う。




2015年6月25日木曜日

debian,ubuntuインストール後に開発環境を一括でインストールしたい(build-essential)

debianやubuntuインストール後に開発環境を揃えたい場合
一個一個ちまちまインストールすのもめんどくさいし、インストール漏れがあるとライブラリ不足等で、コンパイルが通らなかったりと散々な目に遭います。

そこでbuild-essentialでサクッと環境を整えましょう。

ターミナルで
apt-get install build-essential
を実行するだけ

※こんな表示が出た場合
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
あなたはルートではありません。先ほどのコマンドにsudoコマンドを足して
sudo apt-get install build-essential
と打ち込み、パスワード入力を促されますので打鍵して実行してください。
[sudo] password for ユーザー名:






2015年3月5日木曜日

Arduino UNOのピンマップとpinMode( )の関係について

Arduinoにおいて特定のピン操作をしたい時があります。

出典:ATmega168/328のArduino Pin Mapping

例えば、上図のPD5やPD6をhighにしたいlowにしたい!とか、そこでpinMode()を使用します

・pinMode()の詳細
http://arduino.cc/en/Reference/PinMode
仕様を抜粋すると

Syntax
pinMode(pin, mode)
Parameters
pin: the number of the pin whose mode you wish to set
mode: INPUT, OUTPUT, or INPUT_PULLUP.

引数pinには数字を指定しますが、ピンマッピングと照らし合わせることができず、直感的ではありません。

どっかで定義されてないかなとArduinoIDEのフォルダを眺めていたら、USB Host Shieldライブラリ内のavrpin.hに参考になる箇所がありました。それをベースにピンマップの対応をdefine文でおこすと以下のとおり。

#define PD0 0
#define PD1 1
#define PD2 2
#define PD3 3
#define PD4 4
#define PD5 5
#define PD6 6
#define PD7 7

#define PB0 8
#define PB1 9
#define PB2 10
#define PB3 11
#define PB4 12
#define PB5 13

#define PC0 14
#define PC1 15
#define PC2 16
#define PC3 17
#define PC4 18
#define PC5 19

公式のLED点滅のサンプルを置き換えてみると

// LED connected to digital pin 13 = PB5

int pin=PB5;
void setup()
{
    pinMode(
pin, OUTPUT); // sets the digital pin as output
}
    void loop()
{
    digitalWrite(
pin, HIGH); // sets the LED on
    delay(1000); // waits for a second
    digitalWrite(
pin, LOW); // sets the LED off
    delay(1000); // waits for a second
}



これでピンマップに従いながら開発をすることができます。