Skip to main content

button

Example Button Code for the DollyShield

/*

  Example code for  DollyShield pushbutton reading
  For use with the Arduino IDE or libraries.
  (c) 2010 C.A. Church
  Licensed under GPLv3

*/

 // digital pin # for button
#define BT_PIN_D  14
 // range threshold
#define BT_THRESH 70
 // num buttons
#define BT_NUM    5

int buttons[5] = {70, 250, 450, 655, 830};

int bt_range[5][2];

void setup() {

 pinMode(BT_PIN_D, INPUT);
 digitalWrite(BT_PIN_D, HIGH);
 
 Serial.begin(19200);

   // setup pushbutton lookup table

 for (byte i = 0; i < BT_NUM; i++) {  
   bt_range[i][0] = buttons[i] - BT_THRESH;
   bt_range[i][1] = buttons[i] + BT_THRESH;
 }

}

void loop() {

 byte button = get_button();

 if( button ) {
    Serial.print("Pressed Button: ");
    Serial.println(button, DEC);
 }

 delay(200);

}

byte get_button() {

  // returns button pressed
  //  1-5 for pushbuttons
  //  0 for no button pressed

  // need analog pin # for analogRead

The DollyShield: Arduino Shield for Timelapse Motion Control

The DollyShield is an adaptation of the Arduino Motor Shield v3 that provides directional PWM control of two DC motors, at up to 1A of current each.  In addition to the motor drivers, it also provides a stereo plug with dual opto-coupled outputs for direct camera control, a 2x16 LCD, five user input buttons, and four auxilliary inputs or outputs through two stereo jacks.  It is designed to provide an inexpensive and easy-to-use interface for two-axis motion control integrated with a camera.

 

 

DollyShield v1.0 Front 

Syndicate content