canon_ble #82
|
@ -1,12 +1,15 @@
|
|||
#include "McopySerial.h"
|
||||
|
||||
void McopySerial::begin (int baudRate) {
|
||||
baud = baudRate;
|
||||
begin();
|
||||
McopySerial::McopySerial () {
|
||||
|
||||
}
|
||||
|
||||
void McopySerial::begin () {
|
||||
Serial.begin(baud);
|
||||
}
|
||||
|
||||
void McopySerial::setBaud (int baudRate) {
|
||||
baud = baudRate;
|
||||
}
|
||||
|
||||
void McopySerial::debug (bool state) {
|
||||
|
|
|
@ -10,8 +10,10 @@ class McopySerial {
|
|||
volatile bool debugOn = false;
|
||||
|
||||
public:
|
||||
McopySerial();
|
||||
|
||||
void begin();
|
||||
void begin(int baudRate);
|
||||
void setBaud(int baudRate);
|
||||
|
||||
void debug (bool state);
|
||||
void log (String message);
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
#include "McopySerial.h"
|
||||
|
||||
void McopySerial::begin (int baudRate) {
|
||||
baud = baudRate;
|
||||
begin();
|
||||
McopySerial::McopySerial () {
|
||||
|
||||
}
|
||||
|
||||
void McopySerial::begin () {
|
||||
Serial.begin(baud);
|
||||
}
|
||||
|
||||
void McopySerial::setBaud (int baudRate) {
|
||||
baud = baudRate;
|
||||
}
|
||||
|
||||
void McopySerial::debug (bool state) {
|
||||
|
|
|
@ -10,8 +10,10 @@ class McopySerial {
|
|||
volatile bool debugOn = false;
|
||||
|
||||
public:
|
||||
McopySerial();
|
||||
|
||||
void begin();
|
||||
void begin(int baudRate);
|
||||
void setBaud(int baudRate);
|
||||
|
||||
void debug (bool state);
|
||||
void log (String message);
|
||||
|
|
|
@ -33,6 +33,8 @@ volatile bool ledState;
|
|||
const String name_remote = "mcopy";
|
||||
CanonBLERemote canon_ble(name_remote);
|
||||
TickTwo blinker(blink, 500);
|
||||
//McopySerial mc;
|
||||
|
||||
volatile boolean connected = false;
|
||||
|
||||
volatile long now;
|
||||
|
@ -47,12 +49,13 @@ void blink(){
|
|||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(57600);
|
||||
esp_log_level_set("*", ESP_LOG_INFO);
|
||||
|
||||
pinMode(SHUTTTER_BTN, INPUT_PULLUP);
|
||||
pinMode(LED, OUTPUT);
|
||||
|
||||
//mc.begin();
|
||||
|
||||
canon_ble.init();
|
||||
delay(1000);
|
||||
blinker.start();
|
||||
|
@ -71,8 +74,8 @@ void connectBLE () {
|
|||
digitalWrite(LED, HIGH);
|
||||
delay(1000);
|
||||
|
||||
Serial.println("Camera paired");
|
||||
Serial.println(canon_ble.getPairedAddressString());
|
||||
//mc.log("Camera paired");
|
||||
//mc.log(canon_ble.getPairedAddressString());
|
||||
}
|
||||
|
||||
void loop()
|
||||
|
@ -93,7 +96,7 @@ void loop()
|
|||
blinker.update();
|
||||
if (connected && !canon_ble.isConnected()) {
|
||||
connected = false;
|
||||
Serial.println("Disconnected");
|
||||
//mc.log("Disconnected");
|
||||
blinker.interval(500);
|
||||
blinker.resume();
|
||||
}
|
||||
|
@ -102,10 +105,10 @@ void loop()
|
|||
void shutter () {
|
||||
digitalWrite(LED, LOW);
|
||||
blinker.resume();
|
||||
Serial.println("Shutter pressed");
|
||||
//mc.log("Shutter pressed");
|
||||
|
||||
if(!canon_ble.trigger()){
|
||||
Serial.println("Trigger Failed");
|
||||
//mc.log("Trigger Failed");
|
||||
}
|
||||
|
||||
blinker.pause();
|
||||
|
|
Loading…
Reference in New Issue