電子學實驗

實驗參考網址
CH3
CH4
CH5
http://pub.tust.edu.tw/mechanic/mclab/public_html/_private/electronics/diode/circuit.htm

DHT12 溫度.濕度感測器

https://yhhuang1966.blogspot.com/2015/08/arduino-dht11.html
https://github.com/Bobadas/DHT12_library_Arduino
/*
 * 2018.06.12
 * 按照DHP11接角位
 * 左1 3V
 * 左2 D0
 * 左3 空
 * 左4 GND
 */
#include "DHT.h"
#define DHTPIN D0 
#define DHTTYPE DHT11 
DHT dht(DHTPIN, DHTTYPE);

void setup() {
  Serial.begin(9600);
  Serial.println("DHT11 test!");
  dht.begin();
  }

void loop() {
  delay(1000);
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  float f = dht.readTemperature(true);
  if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
    }
  Serial.print("濕度: ");
  Serial.print(h);
  Serial.print("%\t");

  Serial.print("溫度: ");
  Serial.print(t);
  Serial.print("*C\t");

  Serial.println(" ");
  }

烙鐵的保養 && 焊錫使用

http://subig1957.pixnet.net/blog/post/17151058-%E7%84%8A%E9%8C%AB%E8%88%87%E5%8E%BB%E9%8C%AB%E6%BC%AB%E8%AB%87
https://www.mobile01.com/topicdetail.php?f=168&t=5053888
https://www.strongpilab.com/iron-solder-desolder-skill/
https://www.mobile01.com/topicdetail.php?f=116&t=5157858
http://musicalsound.com.tw/diy/solder.htm
http://www.hitonaudio.com/forum_oneissue.php?mi=366&page=3
http://subig1957.pixnet.net/blog/post/17151058-%E7%84%8A%E9%8C%AB%E8%88%87%E5%8E%BB%E9%8C%AB%E6%BC%AB%E8%AB%87
錫聲 && 音響電容

SG90 馬達

#include <Servo.h>

Servo myservo;

void setup()
{
  myservo.attach(D7,500,2400);
}

void loop()
{
  for(int i = 0; i <= 180; i+=1){
    myservo.write(i);
    delay(15);
  }
  for(int i = 180; i >= 0; i-=1){
    myservo.write(i);
    delay(15);
  }
}
//紅接UV
//橘接D7
//咖啡接GND

光敏電阻 && 可變電阻

const byte potpin = A0;
int val; //接收類比輸入值的變數,類行為整數
 //可變電阻輸出範圍值 0~1023
void setup() {
  Serial.begin(9600); // 以9600bps速率初始化序列錐
}

void loop() {
  val = analogRead(potpin);
  Serial.println(val);
  delay(500);
}
http://mcu-tw.blogspot.com/2013/06/arduino-lab-5-led.html

http://coopermaa2nd.blogspot.tw/2010/12/arduino-lab4.html

音樂音量led顯示

// 先用Arduino做 ,之後再找晶片
// https://item.jd.com/24364670781.html
//https://www.banggood.com/With-Housing-DIY-Music-Spectrum-LED-Flash-Kit-DIY-Amplifier-Speaker-Kit-p-986043.html?utm_source=youtube&utm_medium=CreativeChannel&utm_campaign=Nov&utm_content=huangwenjie&cur_warehouse=CN
const byte potPin = A0;
const byte pins[6] = {D3, D2, D4, D5, D6, D0 }; 
int val;
int k;
void setup() {
  Serial.begin(9600);
  pinMode(D0, OUTPUT);
  pinMode(D2, OUTPUT);
  pinMode(D3, OUTPUT);
  pinMode(D4, OUTPUT);
  pinMode(D5, OUTPUT);
  pinMode(D6, OUTPUT);
  for (int thisPin = 0; thisPin < 6; thisPin++) {
  pinMode(pins[thisPin], OUTPUT); }
}

void loop() {
  val = analogRead(potPin);
  Serial.print("val=");
  Serial.println(val);
  k = val/147; //  1024/7 = 147
  Serial.print("val/147=");
  Serial.println(k);
  for (int thisPin = 0; thisPin < k; thisPin++) {
  digitalWrite(pins[thisPin], HIGH); }
  delay (100);
  for (int thisPin = 0; thisPin < k; thisPin++) {
  digitalWrite(pins[thisPin], LOW); }
}