You are reading a single comment by @user100558 and its replies. Click here to read the full conversation.
  • Hi Guys, sorry for my mistake and didn't place the code.

    I'm using cordova with angular v 1.*.

    Follow:

    my head

    <!DOCTYPE html> <html>
        <head>
            <!--
            Customize this policy to fit your own app's needs. For more guidance, see:
                https://github.com/apache/cordova-plugin­-whitelist/blob/master/README.md#content­-security-policy
            Some notes:
                * gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
                * https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
                * Disables use of inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
                    * Enable inline JS: add 'unsafe-inline' to default-src
            -->
            <meta name="format-detection" content="telephone=no">
            <meta name="msapplication-tap-highlight" content="no">
            <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
            <link rel="stylesheet" type="text/css" href="js/bootstrap/css/bootstrap.min.css­">
            <link rel="stylesheet" href="css/angular-material.min.css">
            <link rel="stylesheet" type="text/css" href="css/index.css">
            <link rel="stylesheet" type="text/css" href="css/specialinputs.css">
            <script type="text/javascript" src="js/jquery-2.2.1.min.js"></script>
            <script type="text/javascript" src="js/bootstrap/js/bootstrap.min.js"><­/script>
            <script src="js/angular.js"></script>
            <script src="js/angular-route.js"></script>
            <script src="js/angular-animate.js"></script>
            <script src="js/angular-aria.min.js"></script>
            <script src="js/angular-messages.min.js"></scrip­t>
            <script src="js/angular-material.min.js"></scrip­t>
            <script src="https://www.puck-js.com/puck.js"></­script>
            <script src="https://maps.googleapis.com/maps/ap­i/js?key=AIzaSyDKO91w7TH8iP4MN1ziQT0BOqj­sWtJtpqk&libraries=places,drawing,geomet­ry" async defer></script>
            <title>Myspot</title>
    

    Then, my code in the angular file.

    scope.btnstatus = function(action) {
            if(action == 'on') {
                Puck.write('LED1.set();\n',function() {
                alert(Puck.getBatteryPercentage());
                initMap();
                });
            }
            else {
                Puck.write('LED1.reset();\n',function() {
                    //Puck.magOff();
                });
            }
        };
    
        $scope.magOn = function() {
            Puck.magOn();
            Puck.on('mag', function(xyz) {
                console.log(xyz);
            });
        }
    
About

Avatar for user100558 @user100558 started