Basic question about input from Arduino to M5Stick C
-
.
Sorry for a very basic question. I have almost no knowledge of how to use the M5Stick C. I use the stick to bluetooth trigger my Blackmagic Design cinema camera ( I am a wildlife film maker). This fires the shutter very well via the inbuilt button.
I also have built an Arduino based pir and a breakbeam system that fires another camera via an analogue input. What I would like to do do is use the Arduino based trigger devices to trigger my bluetooth controlled camera as it has no analogue input. The trigger uses an simple relay to close the circuit on the other camera, but as the camera I want to control only uses bluetooth I would like the M5Stick C to trigger the camera from the PIR / Breakbeam system.Is that even possible? Any help with connection and coding would be very gratefully received.
-
@geoffs It sounds like you already have done the hard work of getting the stickC to communicate with the BMD camera.
There are PIR hats and units available for the stickC
https://m5stack.com/collections/m5-unit/products/pir-module?ref=pfpqkvphmgr
https://m5stack.com/collections/m5-hat/products/m5stickccompatible-hat-pir-sensor?ref=pfpqkvphmgrThe following code is for the PIR unit
// initialization M5.begin(); pinMode(36, INPUT);// set pir sensor pin as input // read data int value = digitalRead(36);// read the pin(0: not detectd 1: detected) M5.update();
-
@ajb2k3 said in Basic question about input from Arduino to M5Stick C:
pinMode(36, INPUT);// set pir sensor pin as input
// read data
int value = digitalRead(36);// read the pin(0: not detectd 1: detected)Thank you ajb2k3
I will give it a go. -
Hi again ajb2k3,
I am not sure why but it does not seem to work with my set up.Here is the code I am using for the stickC to trigger camera. Where would I put the code you suggested? Thanks in advance!
#include <M5StickC.h>
#include <BlueMagic32.h>#define LED_PIN 10
#define TRIGGER G0void setup()
{M5.begin();
Serial.begin(115200);pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, HIGH);BMDConnection.begin("BlueMagic32");
BMDControl = BMDConnection.connect();M5.Lcd.setTextColor(TFT_WHITE);
M5.Lcd.setTextSize(2);
M5.Lcd.setRotation(3);
M5.Lcd.fillScreen(TFT_BLUE);
}void loop()
{
// read data
int value = digitalRead(36);// read the pin(0: not detectd 1: detected)
M5.update();if (M5.BtnB.wasPressed())
{
ESP.restart();
}if (BMDConnection.available())
{M5.Lcd.drawCentreString(BMDControl->timecode(), 80, 34, 2); if (M5.BtnA.wasPressed()) { BMDControl->toggleRecording(); } if (BMDControl->isRecording()) { M5.Lcd.setTextColor(WHITE); digitalWrite(LED_PIN, LOW); } else { M5.Lcd.setTextColor(TFT_GREEN); digitalWrite(LED_PIN, HIGH); } M5.Lcd.fillScreen(TFT_BLACK);
}
if (M5.BtnA.wasPressed())
{
BMDControl->toggleRecording();
}if (BMDControl->isRecording()) { M5.Lcd.setTextColor(RED); digitalWrite(LED_PIN, LOW); }
}