- 打光罩,你可以直接用簡易的相機照明圓頂,也可以自己列印一個
- LED(50), 如果你直接買現成的相機照明圓頂,那就買10mm的燈泡,如果你自己列印的話,就換成5mm燈泡
- LED陣列,Adafruit 16x8 LED Matrix Driver Backpack(HT16K33 Breakout)
- Arduino Uno
- 磁簧開關
建構RTI系統
電路圖
建立RTI檔案
3D打光罩
RTI LED打光罩的程式碼
#include
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
Adafruit_8x16matrix matrix = Adafruit_8x16matrix();
#define BUSY_LED 13 // Board IO pin of Arduino ORANGE LED
#define CAMERA_CTL 12 // Board pin controlling the Camera Trigger
// active low.
#define LED_COUNT 50 // number of LEDs to sequence through
void setup() {
Serial.begin(9600);
Serial.println("RTI multi-spectral camera");
matrix.begin(0x70); // pass in the I2C address
matrix.clear(); // clear all lights
matrix.writeDisplay();
// set the digital pin as output:
pinMode(CAMERA_CTL, OUTPUT);
digitalWrite(CAMERA_CTL, HIGH); // active low
// set up Arduino LED as output
pinMode(BUSY_LED, OUTPUT);
digitalWrite(CAMERA_CTL, HIGH); // active low
}
/* array indexes - insert LED with long lead on A line.
15 A15 * * * * * * * *
14 A14 * * * * * * * *
. * * * * * * * *
. * * * * * * * *
. * * * * * * * *
1 A1 * * * * * * * *
0 A0 * * * * * * * *
Y= C7 C6 C5 C4 C3 C2 C1 C0
X= 0 1 2 3 4 5 6 7
*/
void loop() {
int x,y,count=0;
for(x=0;x<8;x++) // x's are the C lines
for(y=0;y<11;y++) // y's are the A lines { // toggle BUSY LED digitalWrite(BUSY_LED, HIGH); // ON // turn on one LED matrix.drawPixel(x, y, LED_ON); matrix.writeDisplay(); // write the changes we just made to the display delay(6000); // this delay determines the length the led is on // trigger the camera digitalWrite(CAMERA_CTL, LOW); // active low delay(50); digitalWrite(CAMERA_CTL, HIGH); // active low delay(50); // turn off the only LED on matrix.drawPixel(x, y, LED_OFF); matrix.writeDisplay(); // write the changes we just made to the display // delay while image stored on camera? delay(1000); // toggle BUSY LED digitalWrite(BUSY_LED, LOW); // OFF delay(100); // so we can see the OFF state // test for end of light count count++; if( count >= LED_COUNT) goto DONE;
}
DONE:
Serial.println("Camera sequence complete");
while(1); // infinite loop- stop here
}