2016年11月14日 星期一

Week11 河蟹牌 - 有機手工聖誕樹 一棵 4.99 鎂


Arduino官網 ~




Arduino 電路板~~~~ 我用的是大片的 MEGA

插入USB連接後,會發現找不到驅動程式,要從電腦找









路徑是 C:\Users\user\Desktop\葉正聖老師\arduino-1.0.5-r2






然後打開 Arduino




屬性都要跟裝置管理員上的一樣才可以,不然會出錯捏 (我的是大片mega,小片的話是uno)





再來打開範例程式,閃亮聖誕樹~~~


程式碼意思 :

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  This example code is in the public domain.
 */

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() {              
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);  
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

就是一閃一亮的意思


再來按勾勾,確認程式碼正確,在按箭頭將程式碼傳到板子上



LED 短的接 GND (接地),長的接13


成果會變這樣,LED燈會一亮一閃~~~~


帥 真的帥

---------------------我是分隔線---------------------

再來接到麵包板上面

照著這樣的接法接















接好會變這樣



程式碼 :



成果 :





有點亂,不過大致上都知道怎麼接了 ~~




沒有留言:

張貼留言