Posts

ใช้ RPi เป็น webserver + mySql + PHP

credit: http://doc.inex.co.th/r-pi-web-server-installation/  การทำ Web Server บน Raspberry Pi นั้นเริ่มเป็นที่นิยมมากขึ้นเรื่อยๆ เพราะมีต้นทุนถูก และเหมาะกับงานที่ต้องการใช้งานส่วนตัว อีกทั้งยังมีตัวระบบปฏิบัติการที่มีพื้นฐานมาจาก Linux จึงทำให้การใช้งานไม่ต่างจาก Web Server ในปัจจุบันที่เริ่มหันมาใช้ Linux กันแล้ว         ดังนั้นขั้นตอนการติดตั้งจึงคล้ายคลึงกับ Linux Web Server โดยมีขั้นตอนดังนี้  ติดตั้ง Apache        • ทำการติดตั้ง Apache ด้วยคำสั่ง sudo apt-get install apache2 -y (-y คือติดตั้งแพคเกจทันทีโดยไม่ต้องถาม)        • เมื่อติดตั้งเสร็จแล้วให้ลองเปิด Web Browser แล้วเข้าไปที่ IP Address ของ Raspberry Pi เช่น 192.168.1.37 หรือถ้าเปิด Web Browser บน Raspberry Pi ก็ให้เข้าไปที่ http://localhost ก็ได้เช่นกัน จะเห็นว่ามีข้อความแสดงขึ้นต้นว่า It works! หมายความว่า Apache สามารถทำงานได้ปกติดี ติดตั้ง PHP         • ต่อไปให้ทำการติดตั้ง PHP ด้วยคำสั่ง sudo apt-get install php5 libap...

Python run Every day with schedule Lib.

You will have to install their Python library: pip install schedule This is modified from their sample program: import schedule import time def job ( t ): print "I'm working..." , t return schedule . every (). day . at ( "01:00" ). do ( job , 'It is 01:00' ) while True : schedule . run_pending () time . sleep ( 60 ) # wait one minute You will need to put your own function in place of job and run it with nohup, e.g.: nohup python2 . 7 MyScheduledProgram . py & Don't forget to start it again if you reboot.

รวบรวมเกร็ดเล็กเกร็ดน้อยเขียนโปรแกรม Python กับเซนเซอร์ใช้งานกับ RPi 3

I2C LCD 16x2 credit: http://www.circuitbasics.com/raspberry-pi-i2c-lcd-set-up-and-programming/ I2C OLED display edit /boot/config.txt file. Edit it with  $sudo nano /boot/config.txt  and add the text dtparam=i2c1=on dtparam=i2c_arm=on credit: https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c Line Notify change urllib Python3 -> Python2  import zix.moves.urllib as urllib  DHT humidity sensing https://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging?view=all ds18b20 + Rpi + Python https://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing/hardware Install Codebloacks IDE for C Programming sudo apt-get install codeblocks

Autorun when booting up Python RPi

cd .config cd autostart  sudo nano name.desktop และใน file ก็เขียนประมาณนี้นะครับ [Desktop Entry] Type=Application Name=myscript.py Comment=Start my script NoDisplay=false Exec=python /home/pi/myscript.py #โปรแกรมที่จะให้รันตอนบูต  NotShowIn=GNOME;KDE;XFCE; Name[en_US]=myscript.py

SSH to vnc4server with tightvncserver for RPi GUI

$ sudo apt-get install vnc4server  and start $ vnc4server first login -> seting up password configuration with autostart vnc4server $ cd .config $ cd autostart sudo nano vnc4server.desktop [Desktop Entry] Type=Apllication Name=vnc4server Exec=vncserver :1 -geometry 1120x808 -depth 24 -dpi 95 StartupNotify=false ctrl+X -> yes sudo reboot and  start tightVNC viewer WIN10 type password for login vncserver https://www.youtube.com/watch?v=jtgk8MSo_hA

ทริปไปดูกาแฟ ดอยหลวง ดอยช้าง และอาข่าอาม่า 10-11 มกราคม 2560

Image
พี่เอส เจ้าของกาแฟดอยหลวงได้อธิบายว่ากว่าจะมาเป็นหาแฟดอยหลวงมันมีที่มายังไงครับ ยาวเลย จากกำไรหลักพัน ตอนนี้หลายล้านต่อเดือน lol  คั่วตามสูตรกาแฟดอยหลวง QC คัดสิ่งปลอมปน ไปต่ออีกที่ กาแฟดอยช้าง นี่มันอุตสาหกรรมชัดๆ 555 วันละ 100 ตันสด ป๊าด ร้านค้าบนดอยช้าง (ใหญ่) เดินทางต่อไปโอมสเตย์ และที่มาของกาแฟอาข่าอาม่า บ้านแม่จันใต้ ไปถึงค่ำทางลื่นเพราะสองวันนี้ฝนตกพรำๆ ตลอด ถึงเนินสุดท้ายรถไปต่อไม่ได้ต้องลงเดิน นศ ที่มาด้วยถึงกับบ่น ^^ 

รวมวันวานในปี 2559

Image