🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Basic question about input from Arduino to M5Stick C

    M5 Stick/StickC
    2
    4
    4.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      GeoffS
      last edited by

      .
      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.

      ajb2k3A 1 Reply Last reply Reply Quote 0
      • ajb2k3A
        ajb2k3 @GeoffS
        last edited by

        @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=pfpqkvphmgr

        The 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();

        UIFlow, so easy an adult can learn it!
        If I don't know it, be patient!
        I've ether not learned it or am too drunk to remember it!
        Author of the WIP UIFlow Handbook!
        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

        1 Reply Last reply Reply Quote 0
        • G
          GeoffS
          last edited by

          @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.

          1 Reply Last reply Reply Quote 0
          • G
            GeoffS
            last edited by

            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 G0

            void 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);
            }
            

            }

            1 Reply Last reply Reply Quote 0
            • First post
              Last post