puedes modificar este codigo para que cuando recive la señal TTl en el pin 8 mande la…
- User
puedes modificar este codigo para que cuando recive la señal TTl en el pin 8 mande la señal LANC por el pin 7? /* Send a Start/Sop Recording command to the LANC port of a video camera. Tested with a Canon XF300 camcorder This code requires a simple interface see http://micro.arocholl.com Feel free to use this code in any way you want.
Comprehensive LANC info: www.boehmel.de/lanc.htm
"LANC" is a registered trademark of SONY. CANON calls their LANC compatible port "REMOTE".
2011, Martin Koch http://controlyourcamera.blogspot.com/2011/02/arduino-controlled-video-recording-over.html */
#define cmdPin 7 #define lancPin 11 #define recButton 2 int cmdRepeatCount; int bitDuration = 104; //Duration of one LANC bit in microseconds.
void setup() {
pinMode(lancPin, INPUT); //listens to the LANC line pinMode(cmdPin, OUTPUT); //writes to the LANC line pinMode(recButton, INPUT); //start-stop recording button digitalWrite(recButton, HIGH); //turn on an internal pull up resistor digitalWrite(cmdPin, LOW); //set LANC line to +5V delay(5000); //Wait for camera to power up completly bitDuration = bitDuration - 8; //Writing to the digital port takes about 8 microseconds so only 96 microseconds are left till the end of each bit }
void loop() { if (!digitalRead(recButton)) { REC(); //send REC command to camera delay(1000); //debounce button } }
void REC() {
cmdRepeatCount = 0;
while (cmdRepeatCount < 5) { //repeat 5 times to make sure the camera accepts the command
while (pulseIn(lancPin, HIGH) < 5000) { //"pulseIn, HIGH" catches any 0V TO +5V TRANSITION and waits until the LANC line goes back to 0V //"pulseIn" also returns the pulse duration so we can check if the previous +5V duration was long enough (>5ms) to be the pause before a new 8 byte data packet//Loop till pulse duration is >5ms }
//LOW after long pause means the START bit of Byte 0 is here delayMicroseconds(bitDuration); //wait START bit duration
//Write the 8 bits of byte 0 //"18hex" or “00011000” tells the camera that there will be a normal command to camera in the next byte //Note that the command bits have to be put out in reverse order with the least significant, right-most bit (bit 0) first digitalWrite(cmdPin, LOW); //Write bit 0. delayMicroseconds(bitDuration); digitalWrite(cmdPin, LOW); //Write bit 1 delayMicroseconds(bitDuration);
digitalWrite(cmdPin, LOW); //Write bit 2 delayMicroseconds(bitDuration); digitalWrite(cmdPin, HIGH); //Write bit 3 delayMicroseconds(bitDuration); digitalWrite(cmdPin, HIGH); //Write bit 4 delayMicroseconds(bitDuration); digitalWrite(cmdPin, LOW); //Write bit 5 delayMicroseconds(bitDuration); digitalWrite(cmdPin, LOW); //Write bit 6 delayMicroseconds(bitDuration); digitalWrite(cmdPin, LOW); //Write bit 7 delayMicroseconds(bitDuration); //Byte 0 is written now put LANC line back to +5V digitalWrite(cmdPin, LOW); delayMicroseconds(10); //make sure to be in the stop bit before byte 1 - Assistant
- User
puedes modificarlo para que envie los comandos correctos basandote en esta informacion file:///C:/Users/Arkaitz/Downloads/arduino-lanc-master/arduino-lanc-master/specs/protocol.html
- Assistant
- User
puedes modificar este codigo que teniamos que funcionaba bien pero actualizar la informacion que se envia? // Definición de los pines #define LANC_PIN 7 // Pin conectado a la línea LANC de la cámara #define SIGNAL_PIN 8 // Pin conectado a la salida de 5V del controlador
// Duración de un bit LANC en microsegundos int bitDura = 104; // Duración de un bit en el protocolo LANC (originalmente 104 microsegundos) int halfbitDura = 52; // La mitad de bitDura
- Assistant
- User
- Assistant
- User
- Assistant
- User
- Assistant