Browse Source

Update part link, and some more cleanup.

extract-visca-communication-to-class
Ed Walker 5 years ago
parent
commit
5611eb8817
3 changed files with 28 additions and 24 deletions
  1. +1
    -1
      README.md
  2. +20
    -20
      visca-controller/visca-controller.h
  3. +7
    -3
      visca-controller/visca-controller.ino

+ 1
- 1
README.md View File

@ -29,7 +29,7 @@ camera's control port with a standard ethernet cable.
|4pin Molex Housing|2| |[Link](https://www.mouser.com/ProductDetail/538-22-01-3047/)|
|8pin Molex Header|2| |[Link](https://www.mouser.com/ProductDetail/538-22-23-2081/)|
|8pin Molex Housing|2| |[Link](https://www.mouser.com/ProductDetail/538-22-01-3087/)|
|Crimp contacts for Molex housings|Lots| |[Link](https://www.mouser.com/ProductDetail/538-08-50-0114/)|
|Crimp contacts for Molex housings|Lots| |[Link](https://www.mouser.com/ProductDetail/538-08-51-0108-LP/)|
|Crimp tool for Molex contacts|1| |[Link](https://www.amazon.com/gp/product/B078WPT5M1/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1)|
|Bunch of single row 2.54 pitch pin headers|Bunch| | |
|10k Ohm Resistors|10| |

+ 20
- 20
visca-controller/visca-controller.h View File

@ -21,27 +21,27 @@
#define VISCATX 3
// Button inputs
//#define BTN1 4
//#define BTN2 5
//#define BTN3 6
//#define BTN4 7
//#define BTN5 8
//#define BTN6 9
//#define BTN7 10
//#define BTN8 11
//#define BTN9 12
//#define BTN10 13
#define BTN1 4
#define BTN2 5
#define BTN3 6
#define BTN4 7
#define BTN5 8
#define BTN6 9
#define BTN7 10
#define BTN8 11
#define BTN9 12
#define BTN10 13
int buttons[] = {
4, // BTN1
5, // BTN2
6, // BTN3
7, // BTN4
8, // BTN5
9, // BTN6
10, // BTN7
11, // BTN8
12, // BTN9
13 // BTN10
BTN1,
BTN2,
BTN3,
BTN4,
BTN5,
BTN6,
BTN7,
BTN8,
BTN9,
BTN10
};


+ 7
- 3
visca-controller/visca-controller.ino View File

@ -101,9 +101,7 @@ void processButtons() {
if(millis() > time_now + 100) {
time_now = millis();
for (int i = 0; i < sizeof(buttons) / sizeof (buttons [0]); i++) {
bitWrite(buttonCurrentStatus, buttons[i], (int) digitalRead(buttons[i]));
}
collectCurrentButtonStatus();
int btn1 = buttons[0];
if(buttonPressed(btn1) == true) {
@ -133,6 +131,12 @@ void processButtons() {
}
}
void collectCurrentButtonStatus() {
for (int i = 0; i < sizeof(buttons) / sizeof (buttons [0]); i++) {
bitWrite(buttonCurrentStatus, buttons[i], (int) digitalRead(buttons[i]));
}
}
bool buttonPressed(uint8_t button) {
return getCurrentButtonStatus(button) == true && getPreviousButtonStatus(button) == false;
}


Loading…
Cancel
Save