Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
DslrIr.cpp
00001 /** 00002 * MBED code functionality, including idea of modulating PWM signal, taken from 00003 * https://os.mbed.com/users/viswesr/code/DSLR_Camera_IR_Remote/ 00004 * As the given values did not work on the Nikon D3300, they were modified, 00005 * parameterized, and put into library form. 00006 * 00007 * Inspiration, default values, and an Arduino validation signal were taken from 00008 * https://bayesianadventures.wordpress.com/2013/08/09/nikon-ml-l3-ir-remote-hack/ 00009 * 00010 * Library instructions were taken from https://os.mbed.com/cookbook/Writing-a-Library 00011 */ 00012 00013 #include "DslrIr.h" 00014 00015 DslrIr::DslrIr(PinName pin) : _pin(pin) 00016 { 00017 _pin.period_us(PWM_PERIOD); // set PWM period for Carrier Frequency of 38.4 KHz 00018 _pin = 0; 00019 } 00020 00021 00022 00023 00024 void DslrIr::trigger() 00025 { 00026 _pin = ACTIVE_DUTY_CYCLE; 00027 wait_us(SEQ_ON_1_PERIOD); 00028 _pin = 0; 00029 wait_us(SEQ_OFF_1_PERIOD); 00030 _pin = ACTIVE_DUTY_CYCLE; 00031 wait_us(SEQ_ON_2_PERIOD); 00032 _pin = 0; 00033 wait_us(SEQ_OFF_2_PERIOD); 00034 _pin = ACTIVE_DUTY_CYCLE; 00035 wait_us(SEQ_ON_3_PERIOD); 00036 _pin = 0; 00037 wait_us(SEQ_OFF_3_PERIOD); 00038 _pin = ACTIVE_DUTY_CYCLE; 00039 wait_us(SEQ_ON_4_PERIOD); 00040 _pin = 0; 00041 wait_us(SEQ_OFF_4_PERIOD); // Repeat after 63.2 us 00042 _pin = ACTIVE_DUTY_CYCLE; 00043 _pin = ACTIVE_DUTY_CYCLE; 00044 wait_us(SEQ_ON_1_PERIOD); 00045 _pin = 0; 00046 wait_us(SEQ_OFF_1_PERIOD); 00047 _pin = ACTIVE_DUTY_CYCLE; 00048 wait_us(SEQ_ON_2_PERIOD); 00049 _pin = 0; 00050 wait_us(SEQ_OFF_2_PERIOD); 00051 _pin = ACTIVE_DUTY_CYCLE; 00052 wait_us(SEQ_ON_3_PERIOD); 00053 _pin = 0; 00054 wait_us(SEQ_OFF_3_PERIOD); 00055 _pin = ACTIVE_DUTY_CYCLE; 00056 wait_us(SEQ_ON_4_PERIOD); 00057 _pin = 0; 00058 }
Generated on Fri Sep 9 2022 11:05:30 by
 1.7.2
 1.7.2