2015年11月28日 星期六

Arduino的教學09-使用I2C 2X16 lcd


一、學習目標:學習使用I2C 2X16 lcd
i2c為一種通訊界面,2x16代表lcd為二行,每行可以顯示16個字母。

二、接線圖


SDA – 接 Arduino 的 Analog Pin 4 (Arduino Mega 為 Pin 20)
SCL – 接 Arduino 的 Analog Pin 5 (Arduino Mega 為 Pin 21)
GND – 接 GND
VCC – 接 +5V

三、參考資料:
http://coopermaa2nd.blogspot.tw/2012/09/i2c-16x2-lcd.html

四、程式碼
  1. #include <Wire.h>
  2. #include <LiquidCrystal_I2C.h>
  3.  
  4. LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
  5.  
  6. void setup()
  7. {
  8. lcd.init(); // initialize the lcd
  9. // Print a message to the LCD.
  10. lcd.backlight();
  11. lcd.setCursor(1, 0);//第1列,空1格開始
  12. lcd.print("Hello, world!");
  13. lcd.setCursor(2, 1);//第2列,空2格開始
  14. lcd.print("second line");
  15. }
  16.  
  17. void loop()
  18. {
  19. }
練習一:如何每秒測量一次,利出
  1. #include <Wire.h>
  2. #include <LiquidCrystal_I2C.h>
  3. // set the LCD address to 0x27 for a 16 chars and 2 line display
  4. LiquidCrystal_I2C lcd(0x27,16,2);
  5. int no=0;//計數器
  6. void setup()
  7. {
  8. lcd.init(); // initialize the lcd
  9. // Print a message to the LCD.
  10. lcd.backlight();
  11. lcd.setCursor(1, 0);//第1列,空1格開始
  12. lcd.print("Hello, world!");
  13. lcd.setCursor(2, 1);//第2列,空2格開始
  14. lcd.print("sceond line");
  15. delay(3000);//等3秒
  16. }
  17. void loop(){
  18. no++;
  19. //資料顯示在LCD
  20. lcd.setCursor(0, 0);
  21. lcd.print("No.");
  22. lcd.print(no);
  23. delay(500); //每500ms更新一次
  24. lcd.clear();
  25. }
五、作業:
如何將 HC-SR04 超聲波模組測量結果,以lcd顯示。

  1. #include <Wire.h>
  2. #include <LiquidCrystal_I2C.h>
  3. LiquidCrystal_I2C lcd(0x27,16,2);
  4.  
  5.  
  6. int number=0;
  7. #define TrigPIN 13
  8. #define EchoPIN 12
  9.  
  10. void setup() {
  11. pinMode(TrigPIN, OUTPUT);
  12. pinMode(EchoPIN, INPUT);
  13. lcd.init(); // initialize the lcd
  14. // Print a message to the LCD.
  15. lcd.backlight();
  16. lcd.setCursor(1, 0);//第1列,空1格開始
  17. lcd.print("Hello,HC_SR04!");
  18.  
  19. //序列埠除錯用
  20. Serial.begin(9600);
  21. Serial.println("Hello, HC_SR04!");
  22. delay(1000);
  23. }
  24. void loop() {
  25. float duration, distance;//時間、距離
  26. digitalWrite(TrigPIN, HIGH);
  27. delayMicroseconds(1000);
  28. digitalWrite(TrigPIN, LOW);
  29. duration = pulseIn (EchoPIN, HIGH);//pulseIn ( ) :讀取一個針腳的脈衝時間(HIGH或LOW)
  30. distance = (duration/2)/29;
  31.  
  32. number = number +1;
  33.  
  34. lcd.setCursor (0,0);
  35. lcd.print("No.");
  36. lcd.print (number);
  37. lcd.setCursor(0, 1);
  38. lcd.print ("Dis.");
  39. lcd.print(distance);
  40. lcd.print ("cm");
  41. Serial.print("No.");
  42. Serial.print (number);
  43. Serial.print (" Dis. ");
  44. Serial.print(distance);
  45. Serial.println (" cm");//換行
  46. delay(1000);
  47. lcd.clear();
  48. }
  49.  
畫愛心的方法
  1. #include <Wire.h>
  2. #include <LiquidCrystal_I2C.h>
  3.  
  4. LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display
  5. #if defined(ARDUINO) && ARDUINO >= 100
  6. #define printByte(args) write(args);
  7. #else
  8. #define printByte(args) print(args,BYTE);
  9. #endif
  10. uint8_t heart[8] = {0x0,0xa,0x1f,0x1f,0xe,0x4,0x0};
  11.  
  12.  
  13.  
  14. void setup() {
  15.  
  16. Serial.begin(9600);
  17. lcd.init(); // initialize the lcd
  18.  
  19. // Print a message to the LCD.
  20. lcd.backlight();
  21.  
  22.  
  23. lcd.createChar(0, heart);
  24. }
  25.  
  26. void loop() {
  27.  
  28. lcd.printByte(0);
  29.  
  30. delay(1000);
  31. lcd.clear();
  32.  
  33. }

2015年10月3日 星期六

Arduino的教學08-利用Tera Term 來收集序列埠資料

一、教學目標:利用Tera Term 來收集序列埠(com port )資料

二、Tera Term 可以在底下的網址取得
http://ttssh2.sourceforge.jp/

三、參考資料:
http://coopermaa2nd.blogspot.tw/2012/01/tera-term.html

四、學生作業:
1.請利用tera term來收集
的資料

Arduino的教學07-利用HC-SR04 超音波模組測量距離

一、教學目標:HC-SR04 超音波模組測量距離-led閃爍


Working Voltage: DC 5 V 
Working Current: 15mA 
Working Frequency: 40Hz 
Max Range: 4m 
Min Range: 2cm 
MeasuringAngle: 15 degree 
Trigger Input Signal: 10uS TTL pulse 
Echo Output Signal: Input TTL lever signal and the range in proportion 
Dimension: 45*20*15mm

二、佈線圖



三、程式碼

  1. #define TrigPIN 13
  2. #define EchoPIN 12
  3. #define LED1 8
  4. #define LED2 9
  5.  
  6. void setup() {
  7. pinMode(TrigPIN, OUTPUT);
  8. pinMode(EchoPIN, INPUT);
  9. pinMode(LED1, OUTPUT);
  10. pinMode(LED2, OUTPUT);
  11. }
  12.  
  13. void loop() {
  14. float duration, distance;
  15. digitalWrite(TrigPIN, HIGH);
  16. delayMicroseconds(1000);
  17. digitalWrite(TrigPIN, LOW);
  18. duration = pulseIn (EchoPIN, HIGH);//pulseIn ( ) :讀取一個針腳的脈衝時間(HIGH或LOW)
  19. distance = (duration/2)/29;
  20.  
  21. if (distance <= 100) {
  22. digitalWrite(LED1, HIGH);
  23. delay(distance*1.5 + 10);
  24. digitalWrite(LED1, LOW);
  25. digitalWrite(LED2, HIGH);
  26. delay(distance*1.5 + 10);
  27. digitalWrite(LED2, LOW);
  28. }
  29. delay(100);
  30. }
  31.  

四、作業
1.請將此系統改裝成車雷達(小於一段距離時)產生聲音

五、參考資料
https://eportal.stust.edu.tw/eshare/EshareFile/2014_5/2014_5_c185d20a.pdf
http://blog.lyhdev.com/2012/10/arduino-1hc-sr04.html

2015年8月12日 星期三

Arduino的教學06-利用蜂鳴器來發音

一、教學目標:蜂鳴器來演奏簡單音樂
https://www.arduino.cc/en/Tutorial/Tone
二、佈線圖

以tone(腳位,頻率,時間)函式播放
第一個參數是腳位
第二個參數是音符的頻率
第三個參數代表播放時間長度(ms)。

tone(6,224,500);



練習01-發出簡單三個音
  1. #define tone_pin 8 //發聲的pin
  2. #define NOTE_ 0//
  3.  
  4. #define NOTE_C4 262
  5. #define NOTE_CS4 277
  6. #define NOTE_D4 294
  7. #define NOTE_DS4 311
  8. #define NOTE_E4 330
  9. #define NOTE_F4 349
  10. #define NOTE_FS4 370
  11. #define NOTE_G4 392
  12. #define NOTE_GS4 415
  13. #define NOTE_A4 440
  14. #define NOTE_AS4 466
  15. #define NOTE_B4 494
  16.  
  17.  
  18. int melody[] = {
  19. NOTE_C4 , NOTE_D4 , NOTE_E4
  20. };
  21.  
  22. int noteDurations[] = {
  23. 6, 16, 8
  24. };
  25.  
  26.  
  27. //函式,傳入歌曲的資料,進行播放。
  28. void play(int *melody, int *noteDurations, int num){
  29. for(int note = 0; note < num; note++){
  30. int noteDuration = 3000 / noteDurations[note];
  31. tone(tone_pin, melody[note], noteDuration);
  32.  
  33. delay(noteDuration * 1.30);
  34. }
  35. }
  36. void setup () {
  37. }
  38.  
  39. void loop(){
  40. play(melody, noteDurations, sizeof(melody) / sizeof(int));
  41. delay(2000);
  42. }
  43.  


三、程式碼
  1. #define tone_pin 8 //發聲的pin
  2. #define NOTE_ 0//
  3. #define NOTE_B0 31
  4. #define NOTE_C1 33
  5. #define NOTE_CS1 35
  6. #define NOTE_D1 37
  7. #define NOTE_DS1 39
  8. #define NOTE_E1 41
  9. #define NOTE_F1 44
  10. #define NOTE_FS1 46
  11. #define NOTE_G1 49
  12. #define NOTE_GS1 52
  13. #define NOTE_A1 55
  14. #define NOTE_AS1 58
  15. #define NOTE_B1 62
  16. #define NOTE_C2 65
  17. #define NOTE_CS2 69
  18. #define NOTE_D2 73
  19. #define NOTE_DS2 78
  20. #define NOTE_E2 82
  21. #define NOTE_F2 87
  22. #define NOTE_FS2 93
  23. #define NOTE_G2 98
  24. #define NOTE_GS2 104
  25. #define NOTE_A2 110
  26. #define NOTE_AS2 117
  27. #define NOTE_B2 123
  28. #define NOTE_C3 131
  29. #define NOTE_CS3 139
  30. #define NOTE_D3 147
  31. #define NOTE_DS3 156
  32. #define NOTE_E3 165
  33. #define NOTE_F3 175
  34. #define NOTE_FS3 185
  35. #define NOTE_G3 196
  36. #define NOTE_GS3 208
  37. #define NOTE_A3 220
  38. #define NOTE_AS3 233
  39. #define NOTE_B3 247
  40. #define NOTE_C4 262
  41. #define NOTE_CS4 277
  42. #define NOTE_D4 294
  43. #define NOTE_DS4 311
  44. #define NOTE_E4 330
  45. #define NOTE_F4 349
  46. #define NOTE_FS4 370
  47. #define NOTE_G4 392
  48. #define NOTE_GS4 415
  49. #define NOTE_A4 440
  50. #define NOTE_AS4 466
  51. #define NOTE_B4 494
  52. #define NOTE_C5 523
  53. #define NOTE_CS5 554
  54. #define NOTE_D5 587
  55. #define NOTE_DS5 622
  56. #define NOTE_E5 659
  57. #define NOTE_F5 698
  58. #define NOTE_FS5 740
  59. #define NOTE_G5 784
  60. #define NOTE_GS5 831
  61. #define NOTE_A5 880
  62. #define NOTE_AS5 932
  63. #define NOTE_B5 988
  64. #define NOTE_C6 1047
  65. #define NOTE_CS6 1109
  66. #define NOTE_D6 1175
  67. #define NOTE_DS6 1245
  68. #define NOTE_E6 1319
  69. #define NOTE_F6 1397
  70. #define NOTE_FS6 1480
  71. #define NOTE_G6 1568
  72. #define NOTE_GS6 1661
  73. #define NOTE_A6 1760
  74. #define NOTE_AS6 1865
  75. #define NOTE_B6 1976
  76. #define NOTE_C7 2093
  77. #define NOTE_CS7 2217
  78. #define NOTE_D7 2349
  79. #define NOTE_DS7 2489
  80. #define NOTE_E7 2637
  81. #define NOTE_F7 2794
  82. #define NOTE_FS7 2960
  83. #define NOTE_G7 3136
  84. #define NOTE_GS7 3322
  85. #define NOTE_A7 3520
  86. #define NOTE_AS7 3729
  87. #define NOTE_B7 3951
  88. #define NOTE_C8 4186
  89. #define NOTE_CS8 4435
  90. #define NOTE_D8 4699
  91. #define NOTE_DS8 4978
  92.  
  93.  
  94. int melody[] = {
  95. NOTE_G4, NOTE_G4, NOTE_E4, NOTE_D4, NOTE_E4, NOTE_D4, NOTE_C4,
  96. NOTE_E4, NOTE_D4, NOTE_C4, NOTE_A3, NOTE_G3, NOTE_A3, NOTE_G3,
  97. NOTE_A3, NOTE_A3, NOTE_C4, NOTE_A3, NOTE_C4, NOTE_D4, NOTE_E4,
  98. NOTE_D4, NOTE_D4, NOTE_G4, NOTE_G4, NOTE_E4, NOTE_D4, NOTE_C4,
  99. };
  100.  
  101. int noteDurations[] = {
  102. 6, 16, 8, 8, 8, 8, 4,
  103. 6, 16, 8, 8, 8, 8, 4,
  104. 6, 16, 8, 8, 8, 8, 4,
  105. 6, 16, 8, 8, 8, 8, 4,
  106. };
  107.  
  108.  
  109. //函式,傳入歌曲的資料,進行播放。
  110. void play(int *melody, int *noteDurations, int num){
  111. for(int note = 0; note < num; note++){
  112. int noteDuration = 3000 / noteDurations[note];
  113. tone(tone_pin, melody[note], noteDuration);
  114.  
  115. delay(noteDuration * 1.30);
  116. }
  117. }
  118. void setup () {
  119. }
  120.  
  121. void loop(){
  122. play(melody, noteDurations, sizeof(melody) / sizeof(int));
  123. delay(2000);
  124. }
  125.  
四、作業
1.請加入一個按鈕,按下時發出Do、Re、Mi的音,放開時發出Mi、Re、Do
2.請調整出一首兒歌或校歌

五、參考資料
http://yehnan.blogspot.tw/2012/02/arduinoloudspeaker.html

2015年8月6日 星期四

Arduino的教學05-可變電阻類比輸入與LED燈調速

一、教學目標:將LED燈依可變電阻調速
https://www.arduino.cc/en/Tutorial/AnalogInput

二、接線圖


  1. /*
  2. Analog Input
  3. Demonstrates analog input by reading an analog sensor on analog pin 0 and
  4. turning on and off a light emitting diode(LED) connected to digital pin 13.
  5. The amount of time the LED will be on and off depends on
  6. the value obtained by analogRead().
  7. The circuit:
  8. * Potentiometer attached to analog input 0
  9. * center pin of the potentiometer to the analog pin
  10. * one side pin (either one) to ground
  11. * the other side pin to +5V
  12. * LED anode (long leg) attached to digital output 13
  13. * LED cathode (short leg) attached to ground
  14. * Note: because most Arduinos have a built-in LED attached
  15. to pin 13 on the board, the LED is optional.
  16. Created by David Cuartielles
  17. modified 30 Aug 2011
  18. By Tom Igoe
  19. This example code is in the public domain.
  20. http://arduino.cc/en/Tutorial/AnalogInput
  21. */
  22.  
  23. int sensorPin = A0; // select the input pin for the potentiometer
  24. int ledPin = 13; // select the pin for the LED
  25. int sensorValue = 0; // variable to store the value coming from the sensor
  26.  
  27. void setup() {
  28. // declare the ledPin as an OUTPUT:
  29. pinMode(ledPin, OUTPUT);
  30. }
  31.  
  32. void loop() {
  33. // read the value from the sensor:
  34. sensorValue = analogRead(sensorPin);
  35. // turn the ledPin on
  36. digitalWrite(ledPin, HIGH);
  37. // stop the program for milliseconds:
  38. delay(sensorValue);
  39. // turn the ledPin off:
  40. digitalWrite(ledPin, LOW);
  41. // stop the program for for milliseconds:
  42. delay(sensorValue);
  43. }
練習01-如何將可變電阻的測量值-顯示除錯(Serial Monitor Debug)
  1. int sensorPin = A0; // select the input pin for the potentiometer
  2. int ledPin = 13; // select the pin for the LED
  3. int sensorValue = 0; // variable to store the value coming from the sensor
  4. void setup() {
  5. // declare the ledPin as an OUTPUT:
  6. pinMode(ledPin, OUTPUT);
  7. Serial.begin(9600);
  8. }
  9. void loop() {
  10. // read the value from the sensor:
  11. sensorValue = analogRead(sensorPin);
  12. Serial.println(sensorValue);
  13. // turn the ledPin on
  14. digitalWrite(ledPin, HIGH);
  15. // stop the program for milliseconds:
  16. delay(sensorValue);
  17. // turn the ledPin off:
  18. digitalWrite(ledPin, LOW);
  19. // stop the program for for milliseconds:
  20. delay(sensorValue);
  21. }

2015年8月5日 星期三

Arduino的教學04-霹靂燈與陣列宣告練習

一、教學目標:將LED燈依序點亮
http://ming-shian.blogspot.tw/2013/05/ardunioled_5.html

二、接線圖

三、程式碼

  1. const int analogPin = A0; // the pin that the potentiometer is attached to
  2. const int ledCount = 5; // the number of LEDs
  3. int ledPins[] = {
  4. 7, 8,9,10,11}; // an array of pin numbers to which LEDs are attached
  5.  
  6.  
  7. void setup() {
  8. // loop over the pin array and set them all to output:
  9. for (int thisLed = 0; thisLed < ledCount; thisLed++) {
  10. pinMode(ledPins[thisLed], OUTPUT);
  11. }
  12. }
  13.  
  14. void loop() {
  15. // read the potentiometer:
  16. // int sensorReading = analogRead(analogPin);
  17. // map the result to a range from 0 to the number of LEDs:
  18. //int ledLevel = map(sensorReading, 0, 1023, 0, ledCount);
  19.  
  20. // loop over the LED array:
  21. for (int thisLed = 0; thisLed < ledCount; thisLed++) {
  22. digitalWrite(ledPins[thisLed], HIGH);
  23. delay(100);
  24. digitalWrite(ledPins[thisLed], LOW);
  25. }
  26.  
  27. for (int thisLed = ledCount-1; thisLed >= 0; thisLed--) {
  28. digitalWrite(ledPins[thisLed], HIGH);
  29. delay(100);
  30. digitalWrite(ledPins[thisLed], LOW);
  31.  
  32. if (thisLed ==0){
  33. digitalWrite(ledPins[thisLed], HIGH );
  34. delay(100);
  35. }
  36. }
  37. }
  38.  
  39.  
四、作業練習:
如何利用可變電阻來調整霹靂燈速?

2015年8月4日 星期二

Arduino的教學03-讀取光敏電阻與序列埠輸出

一、教學目標:利用光敏電阻控制 LED燈:

http://yehnan.blogspot.tw/2012/02/arduino_23.html

二、接線圖


三、程式碼

  1. int photocellPin = A0; // 光敏電阻 (photocell) 接在 anallog pin A0
  2. int photocellVal = 0; // photocell variable
  3. int minLight = 600; // 最小光線門檻值
  4. int ledPin = 13;
  5. int ledState = 0;
  6. void setup() {
  7. pinMode(ledPin, OUTPUT);
  8. Serial.begin(9600);
  9. }
  10. void loop() {
  11. // 讀取光敏電阻並輸出到 Serial Port
  12. photocellVal = analogRead(photocellPin);
  13. Serial.println(photocellVal);
  14. // 光線不足時打開 LED
  15. if (photocellVal < minLight && ledState == 0) {
  16. digitalWrite(ledPin, HIGH); // turn on LED
  17. ledState = 1;
  18. }
  19. // 光線充足時關掉 LED
  20. if (photocellVal > minLight && ledState == 1) {
  21. digitalWrite(ledPin, LOW); // turn off LED
  22. ledState = 0;
  23. }
  24. delay(100);
  25. }
練習-01-加入序列埠的除錯(serial moniter)
  1. int photocellPin = A0; // 光敏電阻 (photocell) 接在 anallog pin A0
  2. int photocellVal = 0; // photocell variable
  3. int minLight = 800; // 最小光線門檻值
  4. int ledPin = 13;
  5. int ledState = 0;
  6. int no=0;
  7. void setup() {
  8. pinMode(ledPin, OUTPUT);
  9. Serial.begin(9600);
  10. }
  11. void loop() {
  12. // 讀取光敏電阻並輸出到 Serial Port
  13. photocellVal = analogRead(photocellPin);
  14. no++;
  15. Serial.print("test:");
  16. Serial.print(no);
  17. Serial.print(":");
  18. Serial.println(photocellVal);
  19. // 光線不足時打開 LED
  20. if (photocellVal < minLight && ledState == 0) {
  21. digitalWrite(ledPin, HIGH); // turn on LED
  22. ledState = 1;
  23. }
  24. // 光線充足時關掉 LED
  25. if (photocellVal > minLight && ledState == 1) {
  26. digitalWrite(ledPin, LOW); // turn off LED
  27. ledState = 0;
  28. }
  29. delay(100);
  30. }
四、作業練習
1.請設定當光敏電阻的測量值小於設定值時亮紅色LED燈,否則亮綠燈。

2015年7月31日 星期五

Arduino的教學02-控制 LED 燈光亮度與PWM

一、教學目標:控制LE燈亮度(呼吸燈)


三、程式碼

  1. int brightness = 0; // how bright the LED is
  2. int fadeAmount = 5; // how many points to fade the LED by
  3.  
  4. void setup() {
  5. // declare pin 9 to be an output:
  6. pinMode(9, OUTPUT);
  7. }
  8.  
  9. void loop() {
  10. // set the brightness of pin 9:
  11. analogWrite(9, brightness);
  12.  
  13. // change the brightness for next time through the loop:
  14. brightness = brightness + fadeAmount;
  15.  
  16. // reverse the direction of the fading at the ends of the fade:
  17. if (brightness == 0 || brightness == 255) {
  18. fadeAmount = -fadeAmount ;
  19. }
  20. // wait for 30 milliseconds to see the dimming effect
  21. delay(30);
  22. }
四、作業練習 1.如何讓呼吸燈的變化頻率快一點?

2015年7月29日 星期三

Arduino的教學01-arduino的介紹

一、Arduino簡介
二、實驗器材清單
三、麫包板
         http://www.letry.com.tw/letryhandbookc/handbook.htm
三、第一支程式-Blinking LED
四、作業

  1. 請用麫包板接出二個串聯的LED燈(LED不可以直接接電源會燒毀,須串聯 220歐姆的電阻)
  2. 並聯的LED燈?
  3. 如何讓2個 LED燈交替亮?


程式碼

  1. /*
  2. Blink
  3. Turns on an LED on for one second, then off for one second, repeatedly.
  4. This example code is in the public domain.
  5. */
  6. // Pin 13 has an LED connected on most Arduino boards.
  7. // give it a name:
  8. int led = 13;
  9. int led2 = 12;
  10. // the setup routine runs once when you press reset:
  11. void setup() {
  12. // initialize the digital pin as an output.
  13. pinMode(led, OUTPUT);
  14. pinMode(led2, OUTPUT);
  15. }
  16.  
  17. // the loop routine runs over and over again forever:
  18. void loop() {
  19. digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
  20. digitalWrite(led2, LOW); // turn the LED on (HIGH is the voltage level)
  21. delay(1000); // wait for a second
  22. digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
  23. digitalWrite(led2, HIGH); // turn the LED off by making the voltage LOW
  24. delay(1000); // wait for a second
  25. }
  26.  

三、網路資源

4. Arduino教學

http://1know.net/knowledge/97636f101c46?v=list

5.電阻色碼表


  • Arduino創始人在TED大會的演說 (Massimo Banzi: How Arduino is open-sourcing

練習01:暴力解-霹靂燈

  1. //(1)設定檔
  2. int ledPin1 = 8; // the number of the LED pin
  3. int ledPin2 = 9; // the number of the LED pin
  4. int ledPin3 = 10; // the number of the LED pin
  5. //(2)setup 函式
  6. void setup() {
  7. pinMode(ledPin1, OUTPUT);
  8. pinMode(ledPin2, OUTPUT);
  9. pinMode(ledPin3, OUTPUT);
  10. }
  11. //(3)loop 函式
  12. void loop() {
  13. digitalWrite(ledPin1, HIGH);
  14. delay(100);
  15. digitalWrite(ledPin1, LOW);
  16. delay(100);
  17. digitalWrite(ledPin2, HIGH);
  18. delay(100);
  19. digitalWrite(ledPin2, LOW);
  20. delay(100);
  21.  
  22.  
  23. digitalWrite(ledPin3, HIGH);
  24. delay(100);
  25. digitalWrite(ledPin3, LOW);
  26. delay(100);
  27. digitalWrite(ledPin2, HIGH);
  28. delay(100);
  29. digitalWrite(ledPin2, LOW);
  30. delay(100);
  31. }


Arduino教學
https://www.youtube.com/playlist?list=PLXbFMuyNWWqBQxgALwjrDSEC97f4Krq3P

2015年5月13日 星期三

建立分子模型

https://phet.colorado.edu/zh_TW/simulation/build-a-molecule

建立分子模型 螢幕截圖下載
Version 1.03嵌入
從原子開始,看看您可以建立多少分子。收集您的分子,並檢視其 3D 結構!

翻譯者:
Amber Chang (2011)