2013年11月9日 星期六

自強國中課程程式一 6燈改9燈

/*
  For Loop Iteration

 Demonstrates the use of a for() loop.
 Lights multiple LEDs in sequence, then in reverse.

 The circuit:
 * LEDs from pins 2 through 7 to ground

 created 2006
 by David A. Mellis
 modified 30 Aug 2011
 by Tom Igoe

This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/ForLoop
 */

int timer = 200;           // The higher the number, the slower the timing.

void setup() {
  // use a for loop to initialize each pin as an output:
  for (int thisPin = 2; thisPin < 11; thisPin++)  {
    pinMode(thisPin, OUTPUT);    
  }
}

void loop() {
  // loop from the lowest pin to the highest:
  for (int thisPin = 2; thisPin < 11; thisPin++) {
    // turn the pin on:
    digitalWrite(thisPin, HIGH);  
    delay(timer);                
    // turn the pin off:
    digitalWrite(thisPin, LOW);  
  }

  // loop from the highest pin to the lowest:
  for (int thisPin = 10; thisPin >= 2; thisPin--) {
    // turn the pin on:
    digitalWrite(thisPin, HIGH);
    delay(timer);
    // turn the pin off:
    digitalWrite(thisPin, LOW);
  }
}

2013年10月14日 星期一

使用Arduino UNO 燒錄ATMEGA8 實驗一

使用Arduino UNO 燒錄ATMEGA8

ATmega8-Arduino Pin Mapping (接腳圖)

   http://arduino.cc/en/Hacking/PinMapping?from=Main.PinMapping


參考下圖 連接於麵包板上



軟體操作程序:
使用軟體 ARDUINO 1.05
硬體 Arduino UNO R3

Step 1 : 將 Arduino  UNO 變成 ArduinoISP (上傳 ArduinoISP code 到 UNO板子上)
作法:
將  UNO 連接到 PC ,從選單  File -> Examples -> ArduinoISP and upload this sketch.
Step 2 : 燒錄 bootloader 到 Atmega8
作法:
連接 Atmega (Atmega8 ) to the UNO 板上 ,如上面電路圖所示.
從  選單 Tools -Board 選 Arduino NG or older w/ Atmega8
從  選單 Tools - programer 選 Arduino as ISP
最後  選單 Tools - Burn Bootloader
將 Bootloader燒到 Atmega8

Step 3: 驗證是否成功(將 Blink 範例燒入Atmega8)

作法:
將 Atmega328 從 UNO 板上取下,並且將麵包板上的 Atmega8 放到 UNO的IC座上
 ,請小心接腳不要弄錯  (兩顆IC 缺口要在相同的位置,取下IC前先確認或是查看 )。
並且在拔插IC時要拔下USB接頭讓電源關閉。
完成後 接上USB
從  選單      File – Examples – Basics – Blink  選擇  Blink範例
從  選單       Tools -Board – NG or older w/Atmega8   板子設定
再次確認 COM埠值(會不一樣)
燒錄
稍帶片刻 UNO 板上的 第13腳 LED 會閃表示正常。

Step 4 : 將Atmega8  移回麵包板上,觀察是否正常。

移除上圖黃色與綠色的線,保留其餘連線如下圖
在IC的第19腳接上 220歐姆電阻串聯LED 到 5V端,查看是否LED會閃爍.如下圖。
在拔插IC時暫時中斷電路電源。
另外在 Nirzaree's Blog 中對於UNO PIN13 對應寫錯 應該是 ATMAGE 8的第 19 腳。 


任務成功。



參考網頁

 Nirzaree's Blog Make a standalone Atmega8 circuit
http://nirzaree.wordpress.com/2012/03/07/make-a-standalone-atmega8-circuit/

GROBO 

DIY Arduino - 將Bootloader寫進ATMega晶片





2013年9月6日 星期五

102學年度機器人專題製作免死金牌

希望本組同學能盡量配合使這次的合作非常愉快。

機器人專題製作目標:
  1. 重新檢視在資訊科三年來所學習的專業知識。
  2. 應用重組與創新自己掌握的能力開發機能機器人。
  3. 有效率的學習Arduino著重在理解上。
  4. 完成一件可以在眾人面前發表的完整作品。


取得下列資格者獲頒阿西莫夫免死金牌(Award of Isaac Asimov )一面:(保證及格)
  • 獲得全國技能競賽初賽前五名以上
  • 獲得全國工科技能競賽前20名優勝以上
  • 獲得全國高職專題競賽佳作以上
  • 獲得東區科展佳作以上
  • 獲得花蓮縣機器人類競賽佳作以上
  • 獲得大學辦理之機器人類競賽佳作以上
  • 完成的專題作品獲得科內二位以上老師按讚

免死金牌失效條件(例外狀況):
  • 修課期間任一科目考試作弊
  • 上課玩電動上不當網站屢勸不聽(被抓3次以上)
  • 擾亂上課秩序屢勸不聽,如:老師講課時一直發出聲響(被糾正3次以上)

第二堂課摘要

小組確認


專題網頁設定


Arduino架構說明


題目構思


第一次上課摘要

機器人專題介紹


機器人影片欣賞


小組分組