育秀基金會工作坊

簡介

工作坊

  1. 一人教,三人協助,20 個學生,一次小時。
  2. 一人教焊接與寫程式,三人協助,20 個學生,一次小時。
  3. 分兩組,一人教,一人協助。一組10個學生,一次一小時。
  4. 分兩組,一人教,一人協助。一組教焊接,一組教程式,一組10個學生,一次一小時。

因為現場變數太大,排四種選項。

教學內容:

  1. 教 Arduino ,基礎知識,blink、serial port (筆電按鍵按下,13 腳 led 亮)
  2. 教 Arduino ,基礎知識,blink、焊接光敏電阻,光啟動 led
  3. 已經把程式碼燒入 Arduino ,焊接光敏電阻,光啟動 led

材料 50 份

  1. arduino nano mini
  2. 杜邦線
  3. 光敏電阻
  4. 電阻 10k
  5. led
  6. 電阻 220

準備工具

  1. 烙鐵 *8
  2. 銲錫 *8
  3. 斜口鉗 *4
  4. 剝線鉗 *4
  5. 銅刷 *8
  6. 延長線
  7. usb 隨身碟 (已經裝好 arduino , 驅動)

備註

週三下午兩點去場勘

當天決定其中一種方案

程式碼

blink.ino

int led 13;

void setup()

{

  pinMode(led, OUTPUT); //set digital pin 13 as OUTPUT

}

void loop()

{

  digitalWrite(led, HIGH); //digital pin 13 = HIGH

  delay(500); //delay 500 mini seconds

  digitalWrite(led, LOW);

  delay(500);

}

光敏電阻

---------------------------------------------------------------------------------------------------------------------------

int photocellPin = 2; // 光敏電阻 (photocell) 接在 anallog pin 2

int photocellVal = 0; // photocell variable

int ledPin = 13;

void blinkLED(){

  //function body

  digitalWrite(ledPin, HIGH);   

  delay(3000);                  

  digitalWrite(ledPin, LOW);    

  delay(3000);                  

}

void setup() {

  Serial.begin(9600);

}

void loop() {

  // 讀取光敏電阻並輸出到 Serial Port 

  photocellVal = analogRead(photocellPin);

  

if ( photocellVal < 300 )

{

 blinkLED();

}

  Serial.println(photocellVal);  

  delay(100);       

}