Arduino 新手知識 +:為什麼LED Lab練習時串聯必須要經過一顆220Ω的電阻?

九月 2, 2014 Posted by

問題說明:

為什麼LED Lab練習時串聯必須要經過一顆220Ω的電阻?

因為標準的Arduino版子輸出是3.3V跟5V,不過通常會稍低一點

電子元件說明

LED:通常一般LED的電壓大概在2V左右,最大可能到2.5V左右,而他們的電流大多在20mA也就是約0.02A

 

電阻計算

重要公式

接下來要記得一個公式歐姆定律 R = V/I =>  R=電阻、V=電壓、I=電流

接下來就是把上面的參數套入公式就可以了

(5-2) / 0.02 = 150 Ω,但是實務上為了保險起見,都會選擇較大一點的電阻,也就是220 Ω ,這也是為啥坊間的書跟網路上範例大多是這樣的搭配

本次講解就到這邊,如果想要跟我們互動可以到Arduino Taiwan Developer 台灣自造者俱樂部

[Arduino]-單顆LED閃爍控制

九月 2, 2014 Posted by

功能描述

Arduino ,讓任何人都能變身創意無限的自造玩家,在程式設計領域大家的第一支程式叫Hello world

在硬體自動控制第一支程式叫電路開關,所以本實驗主要是要練習,透過Arduino來控制LED開關

Arduino實驗:001

材料清單:

1.Arduino UNO R3 一片

2.LED燈 ㄧ顆

3.220Ω 電阻(紅紅棕) ㄧ顆

4.單芯電線 兩條

電路圖

Arduino_20140902_LEDblink_bb

程式碼如下

//定義腳位變數讓後面程式可以使用
int led = 13;

// 硬體初始化設定
void setup() {
//設定第幾pin腳,模式為輸出
  pinMode(led, OUTPUT);
}

// 重覆執行
void loop() {
  digitalWrite(led, HIGH); // 此處設定HIGH為高電壓,也可以設為1 或 True
  delay(1000);        // 等待1秒
  digitalWrite(led, LOW); // 此處設定HIGH為高電壓,也可以設為0 或 False
  delay(1000);       // 等待1秒
}


 

本次練習就到這邊,如果想要跟我們互動可以到Arduino Taiwan Developer 台灣自造者俱樂部

PHP range() 函數用法 快速產生各種序列資料

四月 26, 2014 Posted by

產生數字序列(自動產生 1~N 的數字)
===========

<?php

//如我要產生1~5的數字序列
foreach (range(1, 5) as $number) {
echo $number."<br />";
}

?>
執行結果
===========
1
2
3
4
5

※註如果要產生0~100間距10的數字序列,如0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100
只要將上面的函式改成 range(0, 100, 10)即可

產生英文字序列
===========

<?php

//如我要產生a~f的數字序列
foreach (range(‘a’, ‘f’) as $char) {
echo $char."<br />";
}

?>
執行結果
===========
a
b
c
d
e
f

Windows Phone 8.1更新

四月 18, 2014 Posted by

Windows Phone 8.1更新主要加入透明動態磚效果、Action Center訊息通知欄位,以及Wi-Fi Sense無線網路感知器功能等,同時也針對行事曆等既存功能予以更新。而最重要的是,Windows Phone 8.1主要加入數位助理功能「Cortana」,讓使用者能透過自然口語操作手機,同時也配合高度整合手機資料給予適時協助。

f_508702_1

Rails 指定資料庫類型

十二月 11, 2013 Posted by

在產生新的專案時候增加-d 資料庫類型

參考語法如下

rails new 專案名稱 -d 資料庫類型
rails new 專案名稱 –database=資料庫類型

資料庫類型清單

mysql / oracle / postgresql / sqlite3 / frontbase / ibm_db /

sqlserver / jdbcmysql / jdbcsqlite3 / jdbcpostgresql / jdbc /

 

Rails database.yml 更改Port

十二月 11, 2013 Posted by

當某些機器的mysql不是使用預設的3306 Port而是3307該怎麼處理呢

其實很簡單

打開database.yml

development:
  adapter: mysql2
  encoding: utf8
  database: db_name
  username: root
  password: password
  host: 127.0.0.1
  port: 3307 =>你所要連結的Mysql port

增加port:3307即可

Ruby on Rails Windows 7 Install 安裝

十二月 10, 2013 Posted by

要在Windows 7 上安裝Ruby on rails

首先要下載三套軟體

1.Ruby 1.9.3-p484
按此下載

2.Development Kit(For use with Ruby 1.8.7 and 1.9.3)
按此下載

3.Aptana RadRails(RadRails is now included as part of Aptana Studio 3已經內建)
按此下載

依照順序安裝1->2->3

1

i.先安裝Ruby 1.9.3-p484,下圖打圈處的三個選項記得要勾選,其他就下一步、下一步依序完成

2

 

ii.0安裝Development Kit安裝到剛才Ruby 1.9.3-p484安裝路徑下

3

 

ii.1初始化ruby=>到DevKit路徑下 ruby dk.rb initcmdSetup1

ii.2 ruby dk.rb reviewcmdSetup2-1

ii.3 ruby dk.rb install開始安裝DevKit

cmdSetup3

ii.4 C:\Ruby193\DevKit>gem install rails –include-dependencies –no-ri –no-rdoc

※如果安裝上有出現問題建議先移除重新安裝程式後在安裝rails  前先gem update

cmdSetup4

ii.5 驗證一下安裝好的ruby及rails的版本ruby -v 、 rails -v

cmdSetup6

 

ii.6-1 建立個開發目錄RailsWWW

cmdSetup7

 

ii.6-2 進入開發目錄RailsWWW

cmdSetup7-1

 

ii.6-3 建立一個新的網站測試程式=>rails new demoApps

 

cmdSetup7-2

 

cmdSetup7-4

 

ii.6-4 啟動demoApps=>rails s

cmdSetup7-6

 

ii.6-5 啟動瀏覽器再網址列打入localhost:3000即可看到以下畫面

cmdSetup8

iii.1安裝Aptana RadRails完成後打開專案Create Project

createNewProject

iii.2 選擇Rails Project

createNewProject2

iii.3 輸入專案名稱

createNewProject3

iii.4 開始享受Ruby on Rails的開發吧

 

Ruby on Rails 參考資源

十二月 7, 2013 Posted by

以下ROR相關參考資源(會持續更新)

ruby china

http://ruby-china.org/

 

Ruby on Rails 實戰聖經使用 Rails 3.2 及 Ruby 1.9.3

http://ihower.tw/rails3/

 

Ruby on Rails之門外漢心得

http://blog.eddie.com.tw/2010/07/16/internet-campaign-with-ruby-on-rails/

 

向XDite 學 ROR

http://wp.xdite.net/?p=1754

 

Ubuntu 12.04.3 LTS ROR (Ruby on Rails)開發環境安裝

十二月 7, 2013 Posted by

終於裝出一個順序可以正常運作Ruby on Rails 在此做個紀錄給有需要的人
1.進行Linux系統更新
$ sudo apt-get update
$ sudo apt-get upgrade

2.
$ sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev

3.下載1.9.3-p327原始碼接著開始編譯
$ wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.gz
$ tar xvfz ruby-1.9.3-p327.tar.gz
$ cd ruby-1.9.3-p327/
$ ./configure
$ make
$ sudo make install

4.安裝SQLite的Adapter
$ gem install sqlite3 –no-ri –no-rdoc

5.安裝Rails
$ gem install rails –no-ri –no-rdoc

6.安裝node.js
$ apt-get install nodejs

檢查安裝套件版本
$ git –version

$ ruby -v

$ gem -v

$ rails -v

注意我只有在這個版本測試過所以其他版本會遇到的問題我可能也無法知道,以上安裝方式僅供參考

 

安裝 mod_security 導致php 突然無法上傳檔案解決方法

十二月 3, 2013 Posted by

最近幾天突然某一支之前寫的程式無法傳檔案 當下在想最近有裝什麼套件嗎 後來想到因為安全性的關係裝了一個mod_security套件 萬萬沒想到是這個模組讓我的程式無法上傳檔案

而這個模組有些功能又還蠻好用的 於是想說看能否在某些站台服務將他暫時關閉 以下是安裝了mod_security 導致無法上傳檔案解決方法

打開站台設定檔 vim /etc/apache2/sites-available/default加入SecRuleEngine Off

<VirtualHost *:80>
   ServerAdmin service@abc.com
   DocumentRoot /var/www/abc
   ServerName abc.com
    <Directory /var/www/abc>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order allow,deny     
     <IfModule security2_module> <== here
        SecRuleEngine Off         <== here
     </IfModule>                 <== here
   </Directory>
</VirtualHost>

在執行 sudo /etc/init.d/apache2 restart 就完成了

MySQL 中文筆畫排序 規則

十一月 21, 2013 Posted by

最近在測試MySQL的中文排序發現原來在MySQL中文的預設排序如果用UTF8排序會跟我們一般想像的會不一樣 例如假設我們的資料表結構如下 table name:site_tag 欄位: id,tag_name 1 三民 2 大小 3 三國 4 于十二皇子 5 工人 6 小豬

假設用ORDER BY site_tag.tag_name asc 結果如下 3 三國 1 三民 4 于十二皇子 2 大小 6 小豬 5 工人

如果我們想用中文慣用的按照筆畫排序(先比第一個數字,再比整串的) 語法如下 SELECT site_tag.id, site_tag.tag_name FROM site_tag ORDER BY CONVERT(SUBSTR(site_tag.tag_name,1,1) USING big5) ASC, site_tag.tag_name ASC

最後結果 3 三國 1 三民 4 于十二皇子 2 大小 6 小豬 5 工人

是不是很簡單阿

2013 Nokia Champion Asia and Pacific名單

十一月 20, 2013 Posted by

2013年度Nokia Champion Asia and Pacific名單如下,今年入選的名單跟往年有分不同,今年是以區域來區分來自全球各地的開發好手

Nokia Developer Champions

Asia and Pacific詳細名單如下

Australia

Kris Shanahan is the Managing Director of Shantek Studios, an Australia-based game and application developer on the Windows Phone and Windows 8 platforms. Shantek Studios develop self-published apps and games as well as third party applications.

Contact

Lewis Benge is a technical consultant specializing in multi-channel platform development in a range of different verticals. With a strong background in eCommerce and retail, Lewis has a broad range of skills to tackle regular challenges of integration into various hardware and devices, as well as a variety of service-based architectures. More recently Lewis has spent a lot of time focusing on next-generation hardware devices such as Microsoft Kinect, Microsoft Surface, Microsoft Windows 8, and other mobile platforms, and various embedded platforms with a specific focus on how these smarter, smaller devices will affect business and consumer platforms.

Contact

Niall Ginsbourg is a software developer and solutions architect from Melbourne, Australia, focusing on Windows Phone and Windows 8 apps. He works as a freelance developer by day, and in his spare time runs mobilewares.net, a company focused on making consumer apps for Marketplace. Niall has been a Microsoft MVP since 2007 and he’s also the co-founder of the Developed Down Under community initiative, designed to promote Aussie Apps and Publishers to Aussie users via a dedicated App and website.

Contact

Srikanth Nair is a Solutions Architect by day, but he also has a deep passion for all things Windows Phone and Windows 8. In his spare time, Sri runs a Brisbane meet-up focused on the aforementioned platforms, regularly participates in local developer events, blogs, and is active on social media, so as to help fellow developers and the community at large. Sri enjoys public speaking, engaging in healthy debates and discussions, and is passionate about all things IT.

Contact

China

Hai Xu is a mobile developer from Beijing who specializes in platform development in Windows Phone, Qt, Android, and HTML5. He is an expert on mobile sensors and font system. He has published several mobile applications and patents.

Contact

Ziteng Chen is a mobile developer from Beijing whose develops on various mobile platforms and has a keen expertise in Imaging. He shares his ideas on discussion boards and organizes developer meet-ups.

Hong Kong

Jordan Hisashi a mobile developer from the city of Hong Kong. His primary development is the Windows Phone platform.

Indonesia

Adam Ardisasmita is a mobile entrepreneur who specializes in Java ME, NFC and game development. In his downtime, he blogs, engages in public speaking, and social media.

Eko Sakti is a lecturer at the University of Brawijaya Malang Indonesia. Likes blogging, organizing and speaking at developer events, solving problem (research in computer network areas) and creating apps in his spare time.

Jeffrey Hermanto Halimsetiawan is a game and mobile app developer whose expertise is in Java, Windows Phone and Game development. He is also a co-founder of Aksara Studio from Surabaya, Indonesia. In his spare time, he frequently blogs and engages in various social media channels. In his spare time, he enjoys blogging, writing wiki articles and partakes in technical debates on various discussion boards.

Contact

Mohamad Iqbal is a Nokia Developer Certified Trainer from Indonesia who specializes in Windows Phone and Web Apps Development. He enjoys blogging, public speaking, organizing developer events and helps developers in solving their technical issues as needed.

Contact

Puja Pramudya is a big fan of Windows Phone and modern UI. He has deep understanding of the Windows phone platform and experiments with emerging technology such as NFC, augmented reality and location based services. He is also a frequent speaker and trainer at developer events and training sessions.

Contact

Ray Rizaldy is a mobile apps developer, and co-founder of GITS Indonesia. His focus is on UX in mobile apps across all major platforms. Besides developing apps, he also organizes trainings and workshops for students and professional developers. He is a registered Nokia Developer Certified Trainer and his company GITS Indonesia is a member of Nokia Developer Consultancy Network.

Rifauddin Tsalitsy is a game developer whose expertise is in Java, Windows Phone, HTMLS, and Location Based Services (LBS). He is also a co-founder of Creacle Studio from Yogyakarta, Indonesia. He enjoys organizing and speaking at developer events.

Contact

Malaysia

Cheah Wei Leow is an electronic engineer from Penang who specializes in Windows Phone and Imaging. In his spare time, he enjoys blogging, writing wiki articles and partakes in technical debates on various discussion boards.

Walter Wong is an IT Professional from Kuala Lumpur who specializes in Windows Phone and Social Network Apps. He is also a Microsoft Most Valuable Professional (MVP) who enjoys training new developers, public speaking and organizing developer meet-ups.

New Zealand

Atta Elayyan is a UX Designer and Co-Founder of Lazyworm Apps, a start-up based out of Christchurch, New Zealand, and one of the first companies in the world purely focused on delivering Metro-Style applications. Atta takes on several roles, but the bulk of his time is dedicated to the design and refinement of their app experiences. The sole designer behind the hugely popular ‘Metrotube’ and ‘Tweetro’ applications, his work has received much praise from the Windows Phone and Window 8 community. Atta has been designing and delivering consumer based solutions for Microsoft platforms for over 7 years.

Philippines

Gener S. Gabasa is a 4x device winner in Calling All Innovators 2011. Awarded Best Feature Phone Game for MyCheckers, Best Feature Phone App for SketchPadPlus, Best Smartphone App for SketchPadPlus and Hall of Fame Achiever 2011 by Nokia Philippines.

Singapore

Cheng Lei Lim is a mobile developer from Singapore. His primary platform of developer is Windows Phone. He organizes and speaks at developer events.

John Paul Lozano is a Nokia Developer Champion and has a broad experience in Web Apps (s40/Symbian), Symbian, HTML and Java development. He also specializes in Microsoft Windows Phone development.

Contact

Nishant Rana is a Windows Phone developer from Singapore. In his spare time, he organizes developer events and helps new developers on the Nokia discussion board. He is fluent in Hindi and English.

Taiwan

Nguyen Ngoc Quynh is the founder and concept designer from Wawa – VietNam. He loves creating mobile games and applications and social networks. He has a lot of crazy mobile ideas and has already created 1000+ mobile game apps using J2ME with his company

Contact

=> (我在這)Yeh Pu Jung is a mobile developer from Taipei with years of experience in Windows Phone, Web Apps and E-Commerce. At leisure, he writes wiki articles and organizers developer meet-ups.

Vietnam

Phom Quon is a computer scientist from Ho Chi Minh with expertise in Java and Gaming development. In his spare time, he organizes developer meet-ups and helps developers in solving their technical issues as needed.

Truong Giang is a game designer from Ho Chi Minh with technical experience in windows Phone, Java ME, HTML5 and gaming. He is also bilingual in Vietnamese and English.

Truong Mai Thanh Tri is a mobile games developer from Ho Chi Minh City. He has experience in Windows Phone games (XNA-DirectX) and J2ME games. He loves to share his knowledge with those who need it.

Contact

To Tuong is a mobile developer from Ho Chi Minh whose primary platform of expertise in the Series 40 – Java ME applications. He is fluent in Vietnamese and English.

[LINQ] No.1 LINQ 字串陣列中搜尋

八月 14, 2013 Posted by

[LINQ][String應用] 在字串陣列中搜尋我要的字並且設置條件

範例程式碼如下

//查詢資料來源
string[] words = { "I", "love", "great", "mobilenest" ,"!"};

//LINQ查詢表達式
var sentence =
from word in words
where word.Length != 5 //查詢長度不等於5的值
select word;

//顯示查詢結果
foreach (var str in sentence)
{
   Console.Write(str.ToString()+" ");
}
Console.ReadLine();

LINQ語法查詢的好地方

八月 12, 2013 Posted by

微軟官方LINQ語法查詢的好地方,臨時忘記語法可以來查喔

http://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b

New App Coming Soon…

五月 27, 2013 Posted by

newapp

全新設計

敬請期待…….

 

[htop] top的進階版即時監控軟體

四月 24, 2013 Posted by

使用起來比 top 還直覺好操作,除了有色彩的支援之外,還可以自己選擇想顯示的資訊,是Linux系統必備的即時監控軟體
htop

dpkg指令參考

四月 9, 2013 Posted by
最近在更新Openfire相關套件,因為該軟體是用debin


.deb是Ubuntu的軟體封裝檔案,下載下來後的軟體必須用dpkg指令進行安裝!


指令 功能
dpkg -i package.deb 安裝軟體
dpkg -r package 刪除軟體
dpkg -L package 列出與該package相關聯的文件
dpkg -l package 顯示出該package的版本
dpkg –unpack package.deb 解壓縮 deb 的內容
dpkg -S keyword 搜尋package內容
dpkg -l 列出伺服器中已安裝的package
dpkg -c package.deb 列出package的內容
dpkg –configure package 設定package
dpkg -n 查詢dpkg相關指令

UBUNTU查看硬碟剩餘可用空間

四月 9, 2013 Posted by

在命令列鍵入df -h

執行結果如下

Filesystem Size Used Avail Use% Mounted on
/dev/xvda1  120G 31G 75G 25% /
udev 1.9G 8.0K 1.9G 1% /dev

 

解決 16g 以上 隨身碟無法用 Windows7-USB-DVD-Download-Tool 製作開機碟

四月 8, 2013 Posted by

最近買了二支16g以上的隨身碟
正當想要做Windows開機碟的時候發現無法copy檔案
測試了16g ,32g的依然都無法copy檔案
上網搜尋了各大論壇始終找不到解決方法

終於在國外的一個討論區有個人發現了一個解決方法
在此以Windows 7為測試環境
首先進入windows的命令提示字元(即在開始執行打cmd enter)
1.diskpart (進入磁碟工具程式)
2.list disk 顯示出目前所有的磁碟機
3.select disk 磁碟3 (輸入磁碟機代號,中文版的系統為中文的磁碟N,英文版為DISK N) 選到你隨身碟的那個磁碟代碼 如果不清楚是哪一個可以用大小來區分16g的隨身碟會顯示14g
4.clean (將這個隨身碟清空)
5.create partition primary (建立第一個磁碟區)
6.select partition 1 (選取第一個磁碟區)
7.active (啟動他)
8.format quick fs=fat32 (將他格式化為fat32,不用懷疑就是這樣幹)
9.assign (指派)
10.exit (離開)
11.再執行一次Windows7-USB-DVD-Download-Tool即可成功製作開機碟

參考原文出處
http://blog.aggregatedintelligence.com/2012/09/windows-7-usbdvd-download-tool-fails-to.html

Nokia Taiwan Developer 在Facebook新的開發者專區開張了

十一月 1, 2012 Posted by

最近開了一個新的facebook開發者專區 想要一同討論Windows Phone開發的人可以加入喔 http://www.facebook.com/NokiaTaiwanDeveloper»