顯示具有 光 標籤的文章。 顯示所有文章
顯示具有 光 標籤的文章。 顯示所有文章

2016年8月9日 星期二

Arduino Bluetooth Android control RGB LED





1  Arduino板

2 藍牙模塊HC-05

HC-05藍芽模組
Arduino Uno Pin
VCC
5V
GND
Gnd
TXD
0
RXD
1

3  RGB LED

    Red LED :Arduino Pin 3.  
    Green LEDArduino Pin 5.  
    Blue LEDArduino Pin 6  ( PWM ~ )



4 Code(下載)



        


     

2016年4月6日 星期三

RGB2

網路上找到的聰明代碼,就不用那麼累了。

使用三色全彩LED製造
模組有3個輸出
1. R,紅色輸出,
2. G,綠色輸出,
3. B,藍色輸出.

 3組信號輸出,可通過單片機程式設計實現R,G,B三種顏色的混合達到全彩的效果,
實驗代碼:
int ledPin = 13; // LED is connected to digital pin 13
int redPin = 11;  // R petal on RGB LED module connected to digital pin 11
int greenPin = 9;  // G petal on RGB LED module connected to digital pin 9
int bluePin = 10;  // B petal on RGB LED module connected to digital pin 10
     
void setup()   
{  
         pinMode(ledPin, OUTPUT); // sets the ledPin to be an output
         pinMode(redPin, OUTPUT); // sets the redPin to be an output
         pinMode(greenPin, OUTPUT); // sets the greenPin to be an output
         pinMode(bluePin, OUTPUT); // sets the bluePin to be an output
}   
     
void loop()  // run over and over again 
{   
          // Basic colors: 
          color(255, 0, 0); // turn the RGB LED red 
          delay(1000); // delay for 1 second 
          color(0,255, 0); // turn the RGB LED green 
          delay(1000); // delay for 1 second 
          color(0, 0, 255); // turn the RGB LED blue 
          delay(1000); // delay for 1 second 
 
          // Example blended colors: 
          color(255,255,0); // turn the RGB LED yellow 
          delay(1000); // delay for 1 second 
          color(255,255,255); // turn the RGB LED white 
          delay(1000); // delay for 1 second 
          color(128,0,255); // turn the RGB LED purple 
          delay(1000); // delay for 1 second 
          color(0,0,0); // turn the RGB LED off 
          delay(1000); // delay for 1 second 
}    
    
void color (unsigned char red, unsigned char green, unsigned char blue)     // the color generating function 
{   
          analogWrite(redPin, 255-red);  
          analogWrite(bluePin, 255-blue);
          analogWrite(greenPin, 255-green);

}     

2013年4月18日 星期四

萬花筒

簡單的圖案在萬花筒中千變萬化

正三角形的鏡筒中形成六等分
鏡筒越長可觀察到的六邊形就更多

2010年3月19日 星期五

日蝕(針孔成像)

1月15日(农历初一朔),月球运行到太阳和地球之间,
而日偏食的原因是因为观测者落在月球的半影区中。
传说是上位者行政不善,将有内乱外患天灾的表征,
果然一群小朋友上课时间竟胆敢在教室外流连忘返。

雙手萬能針孔成像

因為光的直線前進的性質
所以在牆上的像是倒立實像
幼幼班小朋友真行
錶帶上的孔也行

2009年11月6日 星期五

謝迺岳老師研習之地上的彩虹

黑色書面紙噴上噴膠,再灑上球形小碎玻璃,背對陽光就可看見地上圓形的彩虹了。

在不同角度所看到的是不同一個彩虹喔