Avatar for Blackhorse

Blackhorse

Member since Jan 2020 • Last active Feb 2021
  • 4 conversations
  • 17 comments

Most recent activity

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Blackhorse

    Cool, that works. Around 30 Seconds but thats ok for me!

    Thanks Gordon!

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Blackhorse

    Let me check. Thanks for the info.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Blackhorse

    Hi Gordon,

    how I can implement the NRF.on("connect") service to check, if there is a bluetooth device connected or not.

    I just want to send signals from Puck to MDBT when they are connected.
    I worked with a variable "connected" and set it to true or false.

    I have to setWatch functions with the Puck button for rising and falling. When I connect and disconnect it via the Puck button all is working.

    But now I removed the battery from the MDBT and the Puck haven´t detected it as disconnected.

    var log = print;
    var uart;
    var status = 0;
    var l;
    var t;
    var counter = 1;
    var connected = false;
    var kb = require("ble_hid_keyboard");
    NRF.setServices(undefined, { hid : kb.report }); 
    
    
    
    
    ///Mode Flashing
    
    
         setWatch(function(c) {
    
           
           
         if (connected == true) {
    
           
         setTimeout(function () {
    
         if (counter == 1){clearInterval(); digitalWrite (LED2, 1);
         uart.write("digitalWrite(LED2,1), digitalWrite(D19, 1);\n");
         }
    
         if (counter == 2){clearInterval(); digitalWrite (LED2, 1);
         uart.write("digitalWrite(LED2,1), digitalWrite(D17, 1);\n");
            }
    
         if (counter == 3){clearInterval(); digitalWrite (LED2, 1);
         uart.write("digitalWrite(LED2,1), digitalWrite(D15, 1);\n");
            }
    
         if (counter == 4){clearInterval(); digitalWrite (LED2, 1);
         uart.write("digitalWrite(LED2,1), digitalWrite(D18, 1);\n");
            }
    
         if (counter == 5){clearInterval(); digitalWrite (LED2, 1);
         uart.write("digitalWrite(LED2,1), digitalWrite(D16, 1);\n");
            }
    
         if (counter == 6){clearInterval(); digitalWrite (LED2, 1);
         uart.write("digitalWrite(LED2,1), digitalWrite(D14, 1);\n");
            }
         }, 1000);
         }
         }, BTN, { repeat: true, edge: 'rising' });
    
    
         setWatch(function(c) {
     
           
           if (connected == false) {
        kb.tap(kb.KEY.ENTER, 0);
       }   
           
           
         if (connected == true) {
    
         var l = c.time-c.lastTime;  
    
         if ((c.time-c.lastTime > 0.3) && (c.time-c.lastTime < 1.0)) 
         {counter = counter + 1;}
    
         if (counter > 6)
         {counter = 1;}
    
    
          log("Counter:");
          log(counter); 
    
          if (counter == 1)
          {clearInterval();
          setInterval("{digitalPulse (LED2, 1, 50)}", 5000);}
    
          if (counter == 2)
          {clearInterval();
          setInterval("{digitalPulse (LED2, 1, [50, 300, 50])}", 5000);}
    
          if (counter == 3)
          {clearInterval();
          setInterval("{digitalPulse (LED2, 1, [50, 300, 50,  300, 50])}", 5000);}
    
          if (counter == 4)
          {clearInterval();
          setInterval("{digitalPulse (LED2, 1, [50, 300, 50,  300, 50,  300, 50])}", 5000);}
    
          if (counter == 5)
          {clearInterval();
          setInterval("{digitalPulse (LED2, 1, [50, 300, 50,  300, 50,  300, 50,  300, 50])}",         5000);}
    
          if (counter == 6)
          {clearInterval();
          setInterval("{digitalPulse (LED2, 1, [50, 300, 50,  300, 50,  300, 50,  300, 50,           300, 50])}", 5000);}
    
         if (counter == 1){digitalWrite (LED2, 0);
         uart.write("digitalWrite(LED2,0), digitalWrite(D19, 0);\n");
         }
    
         if (counter == 2){digitalWrite (LED2, 0);
         uart.write("digitalWrite(LED2,0), digitalWrite(D17,0);\n");
            }
    
         if (counter == 3){digitalWrite (LED2, 0);
         uart.write("digitalWrite(LED2,0), digitalWrite(D15, 0);\n");
            }
    
         if (counter == 4){digitalWrite (LED2, 0);
         uart.write("digitalWrite(LED2,0), digitalWrite(D18, 0);\n");
            }
    
         if (counter == 5){digitalWrite (LED2, 0);
         uart.write("digitalWrite(LED2,0), digitalWrite(D16, 0);\n");
            }
    
         if (counter == 6){digitalWrite (LED2, 0);
         uart.write("digitalWrite(LED2,0), digitalWrite(D14, 0);\n");
            } 
         }
              }, BTN, { repeat: true, edge: 'falling' });
    
    //BLE Connect
    
        function flag(e) {
      
        var l = e.time-e.lastTime;  
        if ((e.time-e.lastTime < 0.3) && (connected == false)){
        log("Sending command");
        log("Searching for device...");
        NRF.requestDevice({ filters: [{ namePrefix: 'MDBT42Q' }] }).then(function(device) {
        log("Connecting...");
        device.on('gattserverdisconnected', function() {
        });
        return require("ble_uart").connect(device);
        }).then(function(u) {
        log("Connected");
        digitalPulse(LED3, 1, 300);
        uart = u;
        connected = true;
          counter = 1;
        });}
          
    ///BLE Disconnect
      
        
         setTimeout(function(device) {
         
         if (connected == true){ 
         uart.disconnect();
         log("Disconnected");
         connected = false;
         counter = 1;
         digitalPulse (LED3, 1, [50, 300, 50]);
         clearInterval();
         }
         }, 60000);
         
        if ((e.time - e.lastTime < 0.3) && (connected == true) ){
        setTimeout(function(device) {
        uart.disconnect();
        log("Disconnected");
        connected = false;
                      
        if (connected == false){
        clearInterval();
        digitalPulse (LED3, 1, [50, 300, 50]);
        digitalWrite(D14, 0);
       ...
    
    

    Best regards

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Blackhorse

    Hi Gordon,

    thank you very much for you help. I will test it.

    Yes exactly I posted a video with a eating device.
    Maybe I need to come back to you regarding the CE-Certification I have to do for medical devices.
    I don´t know the requirements yet but I think I have to give information also to the basic product as I buy it about quality management, single parts on the pcb, material etc.

    I know its a tired topic but the Medical Device Regulation is very seriously :(

    Best regards

    • 8 comments
    • 254 views
  • in Puck.js, Pixl.js and MDBT42
    Avatar for Blackhorse

    Hi Gordon,

    thanks for the update.

    I wanted to ask again, if it possible to use Puck.js and the MDBT42Q for a commercial project?
    Few month ago I started to develope a solution for disabled people, using Puck.js and the MDBT-Module (modified with an output PCB with Jack plugs), to switch multiple devices with one button. On top a cellphone application + speech recognition.

    And my second question is how to implement a mini smd buzzer like this:
    https://www.sancobuzzer.com/smd-buzzer/5­7404424.html

    I soldered one between D11 and GND on Puck.js and found your awesome tutorial to make sound + music with Espruino.
    I hear a sound but very quiet and not useful. What I want to do is to give an acoustic feedback next to the LED when the user presses the Puck.

    Best regards

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Blackhorse

    Hey, now it worked.

    Strange, on friday I ordered three Puck´s and I got the message that the ordered value is not in stock.
    I changed to one Puck but got the same message.

    Today it worked.

    Best regards

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Blackhorse

    Hey,

    I see Puck.js ist not available at the moment.
    When its again in stock?

    Greetings

  • Avatar for Blackhorse

    Hi Gordon,

    now I understand. Thank you very much!

    Best regards

Actions