• Increase font size
  • Default font size
  • Decrease font size
  • default color
  • cyan color
  • red color

Arduino.TW樂園

Member Area
讀取蜂鳴片訊號
站長Blog文章單元 - 入門教學(連接小電阻,光敏,五分鐘搞定的)
作者是 xlinx   
週一, 10 四月 2006 16:18

接線圖如上圖所示

穩壓二極體上面的粗線條部分要連接+

材料:

穩壓二極體5.1V

10K歐姆電阻

蜂鳴片一片

code:

 


int potPin = 2;         //設定讀入的腳位
int val = 0;      
 
void setup() {
  Serial.begin(9600);
}
 
void loop() {
  val = analogRead(potPin);   
  Serial.println(val);     //將讀取的數值顯示在serialmonitor
  delay(25);
}

 

[download code]

 

結果

 


blog comments powered by Disqus
最近更新在 週六, 29 五月 2010 23:53