วันศุกร์ที่ 28 มิถุนายน พ.ศ. 2556

04>วิธีติดตั้ง Ubuntu 12.04 LTS อย่างละเอียด (คัดลอกมาจาก http://www.gotoknow.org/posts/483406 คุณสุไรนันท์ ขะมิมะ )

วิธีติดตั้ง Ubuntu 12.04 LTS อย่างละเอียด

- ขั้นตอนการแบ่ง Partition ด้วย GParted บน Ubuntu
การใช้ GParted Live CD สำหรับการจัดการพาร์ทิชัน
1. บูท  Ubuntu ผ่าน CD-ROM
Double Click on image to Enlarge.
2. เลือก Try Ubuntu 12.04 LTS คือ บูทเข้า ubuntu โดยการไม่ติดตั้งใดๆมาที่ harddisk
Double Click on image to Enlarge.

3.  ไปที่โปรแกรม GParted
Double Click on image to Enlarge.
4.  ตัวโปรแกรม GParted จะสเกน Partition ของเครื่อง
Double Click on image to Enlarge.

- ขั้นตอนการลด Partition

คลิกขวาแล้ว Resize/Move ที่ไดร์ฟ G:
Double Click on image to Enlarge.
กำหนดขนาดใหม่
Double Click on image to Enlarge.
ขนาด Partition ที่ G: ลดลงมาแล้ว 10 GB
Double Click on image to Enlarge.

 - ขั้นตอนการสร้าง Partition
คลิกเลือก New ที่ unallocated 10 GB ที่เราได้ทำการแบ่งมาจากไดร์ฟ G:

Double Click on image to Enlarge.
จะได้หน้าตาแบบนี้ แบ่งพื้นที่ 6 GB ที่เราจะใช้สำหรับ 5GB ext4 และ 1GB Linux swap ส่วน 4GB ที่เราไม่ได้ใช้ให้เป็น root
Double Click on image to Enlarge.
จะได้ขนาดพื้นที่  Root ขนาด  4GB และ พื้นที่ว่าง(unallocated)  6GB
Double Click on image to Enlarge.
สร้าง ext4 ขนาด 5GB เพื่อใช้สำหรับติดตั้ง Ubuntu
Double Click on image to Enlarge.
สร้าง Linux Swap ขนาด  1GB
Double Click on image to Enlarge.
จะได้พื้นที่ฮาร์ดดิสก์ที่ทำการแบ่งเสดแล้วตามรูปดังนี้
Double Click on image to Enlarge.
คลิกเลือก Apply และรอให้โปรแกรมมำการแบ่งฮาร์ดดิสก์ที่เราได้สร้างไว้
Double Click on image to Enlarge.

เมื่อเปิดข้อมูลฮาร์ดดิสก์ดูจาก Windows จะได้ดังนี้
Double Click on image to Enlarge.
สรุปขั้นตอนการจัดการ Partition 

    ในที่นี้ได้มีการแบ่งพื้นที่ว่างมาจากไดร์ฟ G: เพื่อใช้สำหรับติดตั้ง  Ubuntu    ขนาด 10GB จากนั้นทำการแบ่งย่อยพื้นที่  10GB ให้เป็น root ขนาด 4.50GB และพื้นที่ ext4 5GB ใช้สำหรับพื้นที่ติ้งตั้ง Ubuntu และ Linux Swap ขนาด 1GB เพื่อ linux swap นี้จะทำหน้าที่หลักเหมือนเป็น RAM สำรองเมื่อ RAM จริงมีการใช้งานจนหมด
- ขั้นตอนการติดตั้ง Ubuntu 12.04 LTS

1. Boot Ubuntu ด้วย CD-ROM และเริ่มแรกให้เลือก Try Ubuntu เพื่อทดสอบการใช้งานบนเครื่องคอมพิวเตอร์ของเราก่อนว่าสามารถทำงานได้ตามปกติหรือไม่ เช่น Network และในเรื่องอื่นๆ 
Double Click on image to Enlarge.


2. เข้าสู่หน้าต่างของ  Ubuntu 12.04 LTS ซึ่งยังเป็น  Beta 1 อยู่ 
Double Click on image to Enlarge.


3. เมื่อทำการทดลองใช้แล้วไม่มีปัญหาอะไรในการใช้งานก็ให้เลือก  Install Ubuntu 12.04  ได้เลย จะมีการให้เลือกภาษาเพื่อให้สะดวกต่อการใช้งานของผู้ใช้ ในที่นี้เลือกเป็น English และเลือก > Continue
Double Click on image to Enlarge.


4. หน้านี้จะเป็นการยืนยันตรวจสอบพื้นที่สำหรับติดตั้ง  Ubuntu 12.04 LTS ว่ามีพื้นที่เพียงพอหรือไม่ รวมถึงการตรวจสอบพลังงานแบตเตอรี่ และการเชื่อมต่ออินเตอร์เน็ตด้วย กรณีมีการเชื่อมต่ออินเตอร์เน็ตอยู่ให้เลือกติ๊กถูกที่
>Download updates while installing
>Install this third-party software
และเลือก > Continue
Double Click on image to Enlarge.


5. เลือก Something else เพื่อให้เราสามารถสร้างพื้นที่และเลือกพื้นที่สำหรับการติดตั้งตามที่เราต้องการได้
Double Click on image to Enlarge.


6. เลือกพื้นที่ฮาร์ดดิสก์ที่เราได้ทำการแบ่งไว้ในขั้นตอนที่แล้ว ให้เลือกติดตั้ง Ubuntu 12.04 LTS บน ext4 
Double Click on image to Enlarge.
Double Click on image to Enlarge.


8. เมื่อเลือกพื้นที่สำหรับ  Ubuntu 12.04 เรียบร้อยแล้วให้เลือก  Install Now เพื่อทำการติดตั้ง
Double Click on image to Enlarge.


9. ในขณะที่มีการติดตั้งระบบปฏิบัติการ  Ubuntu 12.04 จะมีการสอบถามข้อมูลของผู้ใช้ ว่าขณะนี้เราอยู่ี่ไหนเพื่อทำการตั้งเวลาให้ตรงกับสถานที่ที่ท่านอยู่
Double Click on image to Enlarge.


10. เลือก Keyboard layout ในที่นี้เลือกเป็น English สามารถที่จะเพิ่ม Keyboard layout ในภายหลังได้กรณีที่ต้องการใช้แป้นพิมพ์ Thai ด้วย
Double Click on image to Enlarge.


11. กำหนดชื่อของผู้ใช้และรหัสผ่านในการ Login เข้าสู่ระบบ Ubuntu 12.04 โดยรหัสที่กำหนดในขั้นตอนนี้จะใช้สำหรับการติดตั้งโปรแกรมเสริมอื่นๆด้วย ดังนั้นถ้ามีผู้อื่นที่ลักลอบเข้ามาใช้คอมพิวเตอร์ของคุณ เขาจะไม่สามารถทำอะไรกับคอมพิวเตอร์คุณได้เพราะจะมีการสอบถามรหัสผ่านทุกครั้ง
Double Click on image to Enlarge.


12. ระบบจะทำการติดตั้ง Ubuntu 12.04 อาจใช้เวลานานพอสมควร ระหว่างที่มีการติดตั้งอยู่นั้นจะมีการแนะนำความสามารถต่างๆของ  Ubuntu 
Double Click on image to Enlarge.
Double Click on image to Enlarge.


14. เมื่อทำการติดตั้งเรียบร้อบแล้วรับบจะให้เรารีสตาร์ทเครื่องให้เลือก > Restart Now
Double Click on image to Enlarge.


15. รอให้ระบบรีสตาร์ทเครื่อง โดยจะให้เรากด Enter เพื่อทำการเริ่มระบบใหม่ ให้ทำการกด Enter
Double Click on image to Enlarge.


16. ก่อนเข้าสู่ระบบจะมีการสอบถามรหัสผ่าน ใช้รหัสผ่านที่เรากำหนดไว้เพื่อยืนยันตัวผู้ใช้
Double Click on image to Enlarge.


17. หน้าตาของ  Ubuntu 12.04
Double Click on image to Enlarge.


18. ทดสอบการใช้งาน Network
Double Click on image to Enlarge.


19. ทำการ Updates Available... 
Double Click on image to Enlarge.


20. เลือก > Partial Updates
Double Click on image to Enlarge.


21. ระบบจะมีการสอบถามรหัสผ่านก่อน ให้ใส่รหัสผ่านของเราและเลือก  OK
Double Click on image to Enlarge.


22. รอให้ระบบอัพเดทจนเสร็จ กรณีที่ความเร็วอินเตอร์เน็ตค่อนข้างมีความเร็วต่ำ ในขั้นตอนนี้ก็อาจจะต้องใช้เวลาในการอัพเดทพอสมควร
Double Click on image to Enlarge.


23. เลือก > Start Upgrade
Double Click on image to Enlarge.


24. รอให้ระบบอัพเดทข้อมูลเสร็จเรียบร้อย สามารถดูรายละเอียดต่างๆได้ว่ามีการอัพเดทอะไรบ้าง
Double Click on image to Enlarge.


25. เมื่อมีการอัพเดทเสร็จเรียบร้อยแล้วระบบจะถามให้รีสตาร์ทเครื่องคอมพิวเตอร์อีกครั้ง ให้เลือก >Restart Now
Double Click on image to Enlarge.


26. เข้าไปที่ > System Setting เพื่อทำการตรวจสอบไดรเวอร์ที่ยังไม่มีการติดตั้ง
Double Click on image to Enlarge.


27. ทำการติดตั้งไดรเวอร์ที่ยังไม่ได้ทำการติดตั้ง
Double Click on image to Enlarge.


28. เมื่อทำการอัพเดทข้อมูลอะไรเรียบร้อยแล้ว ก็ทดลองตรวจสอบอีกครั้งว่ามีการอัพเดทอะไรเพิ่มเติมอีกหรือไม่ถ้าไม่มีการอัพเดทก็เป็นอันสิ้นสุดสำหรับการติดตั้ง  Ubuntu 12.04 LTS 
Double Click on image to Enlarge.

03>Install Driver HP LaserJet P1005 Ubuntu Desktop 13.04

Install Driver Hp Laser-jet P1005
Step 1
 -download "hplip-3.13.6.run"
   form http://hplipopensource.com/hplip-web/models/laserjet/hp_laserjet_p1005.html

 
Step 2
Terminal Method
Assume the file is called some-app.run and is in the folder /home/user/Downloads. You will need to modify these instructions to fit your situation.
  1. Open a terminal (Applications->Accessories->Terminal).
  2. enter cd /home/user/Downloads
  3. enter chmod +x some-app.run
  4. enter ./some-app.run
  5. if step 4 fails with a message including 'permission denied', try entering sudo ./some-app.run (you will need to enter your password for this).

วันพฤหัสบดีที่ 27 มิถุนายน พ.ศ. 2556

02>Install font thai 13 fonts

1.Download font.zip and Extract folder "Font"
2.Open Terminal (Ctrl+Alt+T) type "sudo mkdir /home/mrsaravut/.fonts"
3.$cd Font  and $sudo cp *.* /home/mrsaravut/.fonts

comment :  mrsaravut is user login 

01>ubutu 13.04 รีเทิร์น

Install driver nvidia for dell vostro 1400
To Install/Update Nvidia card drivers open Terminal (Press Ctrl+Alt+T) and copy the following commands in the Terminal:

  • sudo apt-add-repository ppa:ubuntu-x-swat/x-updates
  • sudo apt-get update
  • sudo apt-get install nvidia-current
When installation complete restart your PC. Now to check the installation was successful Press Window/Super key and type: nvidia x server settings and open it.
 ref: http://www.noobslab.com/2012/10/install-latest-nvidia-drivers-in-ubuntu.html

วันจันทร์ที่ 24 มิถุนายน พ.ศ. 2556

วันเสาร์ที่ 11 พฤษภาคม พ.ศ. 2556

processing basic


Buttons, Switches, LEDs



We'll start our tutorial with three simple light circuits. In the first one, the LED is permanently on. In the second, the LED only lights up when a button is pressed and a circuit is completed. In the third example, we'll replace the manual switch with an Arduino pin (set to output mode), so we can control the LED from our program. Here are three simple circuits to build on your breadboard:

#1: Power an LED from a battery (always on)

First, take the shield of your Arduino board and set the power jumper to the right, so the board will draw power from the power jack instead of the USB bus:
Arduino power jumper
Put the shield back on.

Build the following circuit on your breadboard. Use a 220Ohm resistor (red red brown gold) [confused which reshandy resistor calculator here].

Once you have checked it, connect the 9V battery to your board. The LED should light up and stay on. IF it doesn't you probably need to switch the orientation of the LED. The longer lead, the anode, should be connected to the Resistor, the shorter, cathode, to ground.
IMG_0004
IMG_0005

#2: Make a light switch

Next, we'll insert a switch into the circuit. The momentary switches in your kit are "normal open", meaning that the circuit is interrupted in the idle state, when the switch is not pressed. Pressing the switch closes the circuit until you let go agagin.

IMG_0007
IMG_0006

Optional: If you're ahead, replace the momentary switch with the rocker switch in your kit. or change the circuit so the light is on by default and goes off when you press the momentary switch.


#3: Toggling LED with a mouse button


In the third example, we'll replace the manual switch with an Arduino pin (set to output mode), so we can control the LED from our program. The safe way to do this is to let the Arduino pin sink current - if we toggle the pin low, it acts as ground and current flows through the resistor and the LED as it did in the previous examples. When we take the pin high, to 5V, there is no potential difference and no current flows - the LED stays off.

Since we're now communicating with a computer, we can take power from USB. Disconnect the 9V battery. Remove the shield. Move the power jumper to the left, so the board will draw power from USB.

IMG_0003

I've chosen to connect to pin 2 in this example. You cannot use pins 0 and 1, since they are also connected to the USB serial port that Arduino uses to communicate to Processing or Flash. You may pick a different pin - you'll have to be dilligent to also reflect that change in the code we use to control the pin.

Here's the breadboarded circuit:
IMG_0010
IMG_0011

The code for this example is led_control_01.


Processing: led_control_01.pde
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
int ledPin = 2;
void setup() {
size(200, 200);
arduino = new Arduino(this, Arduino.list()[1], 57600);
arduino.pinMode(ledPin, Arduino.OUTPUT);
arduino.digitalWrite(ledPin, Arduino.HIGH);
}
void draw() {
if (mousePressed == true) {
arduino.digitalWrite(2,Arduino.LOW);
} else {
arduino.digitalWrite(2,Arduino.HIGH);
}
}
Note:Sometimes, you'll have to replace the index into Arduino.list()[] with an appropriate setting for your computer. How do you find out what to use? Run the test script you were assigned for homework that prints out a list of serial ports on your computer. On the PC, you'll usually want to use the number listed next to the highest COM port. If that doesn't work, you'll have to find out which COM port the Arduino board is listed as by going to the Device Manager and looking through the port list (Bjoern can demo this). On the mac, look for an entry like this "/dev/tty.usbserial-A1001NTo" and use the index of that entry.

Optional: If you are ahead, change your code so the light stays on when you press the mouse button, and stays off when you press it again. After that, change your code so the light blinks on/off. Then, have the mouse button switch the light between on and blinking.



#4 Sensing buttons in software

We've used code to trigger output - what about the other direction, sensing physical input in code? Just as easy. Here is a simple switch circuit; we're using Digital I/O pin 2 again, as input this time:

When the switch is open, the Arduino pin (set to input mode) is pulled to 5V - in software, we'll read Arduino.HIGH. When the switch is closed, the voltage at the Arduino pin falls to 0V (because the resistance through the switch is essentially 0 Ohms - see VoltageDividers) - in software, we'll read Arduino.LOW. The pull-up resistor is used to limit the current going through the circuit. In software, we can check the value of the pin and switch between graphics accordingly.
IMG_0012
The corresponding code is in example switch_input_01:
Processing: switch_input_01.pde
/*
* background color changes depending on switch state
*/
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
int switchPin = 2;
void setup() {
size(200, 200);
arduino = new Arduino(this, Arduino.list()[1], 57600);
arduino.pinMode(switchPin, Arduino.INPUT);
}
void draw() {
if(arduino.digitalRead(switchPin)==Arduino.LOW) {
background(255, 0, 0);
} else {
background(0, 0, 0);
}
}

#5 Fading LEDs (optional)

What about those "breathing" LEDs on Mac Powerbooks? The fading from bright to dim and back is done using pulse-width modulation (PWM). In essence, the LED is toggled on and off rapidly, say 1000 times a second, faster than your eye can follow. The percentage of time the LED is on (the duty) controls the perceived brightness. To control an LED using PWM, you'll have to connect it to one of the pins that support PWM output - 9, 10 or 11 on the Arduino. Then use the analogWrite(pin,value) command to set duty between 0 and 255. In this example, I've connected the LED to pin 9.

IMG_0013

Here is the corresponding code example is led_control_05
Processing: led_control_05.pde
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
int pwm=0;
int ledPin=9;
boolean rising=true;
void setup() {
size(200, 200);
arduino = new Arduino(this, Arduino.list()[1], 57600);
arduino.pinMode(ledPin, Arduino.OUTPUT);
arduino.analogWrite(ledPin, pwm);
}
void draw() {
arduino.analogWrite(ledPin, pwm);
println(pwm);
if(rising) {
pwm+=2;
if(pwm>=255) {
rising=false;
}
}
else {
pwm-=2;
if(pwm<=0) {
rising=true;
}
}
}
 
ref: http://transformativedesign.pbworks.com/w/page/22424426/Arduino%20Tutorial%202%3A%20Switches%20and%20LEDs