-
-
Slave Board is
...>one ...=one on and volts 0.05444419012 >process.env ={ "VERSION": "1v85", "BUILD_DATE": "Feb 25 2016", "BUILD_TIME": "14:34:29", "GIT_COMMIT": "0671a2d91de45a0e05c4b2b385264cf2ef16e463", "BOARD": "PICO_R1_3", "CHIP": "STM32F401CDU6", "CHIP_FAMILY": "STM32F4", "FLASH": 393216, "RAM": 98304, "SERIAL": "52004000-13513430-36363435", "CONSOLE": "USB", "EXPORTS": { "jsvLock": 246585, "jsvLockAgainSafe": 246573, "jsvUnLock": 246549, "jsvSkipName": 73829, "jsvMathsOp": 77745, "jsvMathsOpSkipNames": 79377, "jsvNewFromFloat": 246925, "jsvNewFromInteger": 246961, "jsvNewFromString": 249265, "jsvNewFromBool": 246945, "jsvGetFloat": 72061, "jsvGetInteger": 72325, "jsvGetBool": 77497, "jspeiFindInScopes": 80461, "jspReplaceWith": 81929, "jspeFunctionCall": 86157, "jspGetNamedVariable": 80513, "jspGetNamedField": 81661, "jspGetVarNamedField": 81333, "jsvNewWithFlags": 246797 } }
-
Master Board is
={ "VERSION": "1v85", "BUILD_DATE": "Feb 25 2016", "BUILD_TIME": "14:34:29", "GIT_COMMIT": "0671a2d91de45a0e05c4b2b385264cf2ef16e463", "BOARD": "PICO_R1_3", "CHIP": "STM32F401CDU6", "CHIP_FAMILY": "STM32F4", "FLASH": 393216, "RAM": 98304, "SERIAL": "34005000-13513430-36363435", "CONSOLE": "USB", "EXPORTS": { "jsvLock": 246585, "jsvLockAgainSafe": 246573, "jsvUnLock": 246549, "jsvSkipName": 73829, "jsvMathsOp": 77745, "jsvMathsOpSkipNames": 79377, "jsvNewFromFloat": 246925, "jsvNewFromInteger": 246961, "jsvNewFromString": 249265, "jsvNewFromBool": 246945, "jsvGetFloat": 72061, "jsvGetInteger": 72325, "jsvGetBool": 77497, "jspeiFindInScopes": 80461, "jspReplaceWith": 81929, "jspeFunctionCall": 86157, "jspGetNamedVariable": 80513, "jspGetNamedField": 81661, "jspGetVarNamedField": 81333, "jsvNewWithFlags": 246797 } }
-
I made this little video to show what I am talking about.
https://drive.google.com/file/d/1djESTRF6I6BbyA2_IGST9CBFjgB1BcivfA/view?usp=sharing
(Sorry about my kid in the background) -
Slave Handler:
var _interval, _spr, _zones = [B10,B13,B14,B15]; function pwm(zone,brightness, Hz){// 0<brightness<1 Hz>0 if((typeof _interval) !== "undefined"){ clearInterval(_interval); var i = 0; while (_zones[i]){ _zones[i].reset(); i++; } _interval = undefined; } if(0>brightness<1&&0<Hz){ _interval = setInterval(function(){ digitalPulse(_zones[zone], 1, brightness * (1000/Hz)); }, 1000/Hz); } } //power burst on the solenoid then bring the power down to reduce amp draw function ctrlPwm(y){ _spr=y; pwm(_spr,0.9,60); setTimeout('pwm(_spr,0.5,40)',500); } //read voltage to send back to master controller and turn on requested solenoid function spCmd(cmd){ var volt = analogRead('B1'); switch(cmd){ case "one": ctrlPwm(0); return "one on and volts "+volt; case "two": ctrlPwm(1); return "two on and volts "+volt; case "three": ctrlPwm(2); return "three on and volts "+volt; case "four": ctrlPwm(3); return "four on and volts "+volt; case "status": return "volts "+volt; case "off": return "all off and volts "+volt; default: return "woops"; } } SPI1.setup({sck:B3, miso:B4, mosi:B5}); var nrf = require("NRF24L01P").connect(SPI1, B6, B7); function onInit() { nrf.init([0,0,0,0,1], [0,0,0,0,2]); } nrf.solenoidHandler = function() { while (this.getDataPipe()!==undefined) { var data = this.getData(); for (var i in data) { var ch = data[i]; if (ch===0 && this.cmd!=="") { var c = this.cmd; this.cmd = ""; var nrf = this; // evaluate and return a result in the timeout, //so that evaluation errors don't cause the slaveHandler //interval to get removed setTimeout(function() { print("...>"+c); var result = spCmd(c); // evaluate print("...="+result); // send the result back after a timeout setTimeout(function() { nrf.sendString(result); }, 500); }, 1); } else if (ch!==0) { this.cmd += String.fromCharCode(ch); } } } }; onInit(); setInterval(function() { nrf.solenoidHandler(); }, 50);
Response is:
...>one ...=one on and volts 0.05297932402 Uncaught ReferenceError: "b" is not defined at line 1 col 73 ...his.getData();for(var d in b){var a=b[d];if(a>==0&&this.cmd!... ^ in function "solenoidHandler" called from line 1 col 21 nrf.solenoidHandler(); ^ in function called from system
-
Master Handler
SPI1.setup({sck:B3, miso:B4, mosi:B5}); var nrf = require("NRF24L01P").connect(SPI1, B6, B7); function onInit() { nrf.init([0,0,0,0,2], [0,0,0,0,1]); } onInit(); setInterval(function() { nrf.masterHandler(); }, 50); function send(command){ nrf.sendCommand(command, function(r) { print("=="+r); }); }
Response is:
>send('one') =undefined ==one on and volts 0.05297932402 >send('two') =undefined >
-
-
-
-
Similar issue. I am connected to the nrf24lo1 and trying to read data from it. The first command goes great and then when I try to do another through the nrf I get this:
>spCmd("one") Uncaught ReferenceError: "analrgRead" is not defined at line 1 col 7 var a=analrgRead('B1');swivch(b){case'one'<ctrlPwm(0);retuun... ^ in function "spCmd" called from line 1 col 12 spCmd("one")
Obviously it should be analogRead('B1');switch..... ugh....its all messed up.
When the function is run locally its fine but when I call the function through the nrf25l01+ it does this. -
-
-
@user63585 It should work without the sd card. Just make sure the directory is in the right path and the module file names match. I can't remember if it loads from online or the projects folder first and have noticed when wifi connection is slow that it will throw the SD card error on me from time to time. Also you are sending from the right side to the WEB IDE?
-
Looks like your connecting the esp8266. You need to use the code from here. WiFi is not a module.
-
First off the WIZnet problem. That was me reading what I wanted to read (Dyslexia?). Or use DHCP I read getIP() instead of setIP() for the DHCP transaction and it took me reading the WIZ550io documentation to figure out that wasn't its natural state Or what the module doc said. Ooops.... I did however set the IP, DNS manually and was still not getting connected and that's something I'll figure out if and when I need it.
Execution Interrupted Execution Interrupted Execution Interrupted
Doesn't say anything else. Just goes straight down the screen. Tried to reset() and disconnect the WEBIDE and reconnect. Nothing stops it but powering down the PICO. The setTimeout() I actually even tried setting the timeout with an additional 500 milliseconds each.....
-
I did get the WIZ running now. When going to POST I'm getting......
ERROR: Failed! mbedtls_ssl_handshake returned -0x7 ERROR: Failed! mbedtls_ssl_handshake returned -0x7
And I think I got this thing working. And maybe I'm doing this wrong. I would upload the code and then save() which would always end up throwing an ERROR. I just tried after uploading the code instead of save() I ran onInit(). It works but then it either throws an "Execution Interrupted" which goes crazy eating up the screen or just freezes...... so for whatever reason it appears save() is causing issues with this... This is all with the WIZ and still can't get the ESP to work.
-
Well I actually got a bunch of WIZ550io and what do you know. I can't even get them on the internet. Appears to be a similar problem to this one. I have your first run of Picos. Maybe they are defective? I might just order some new ones......
-
-
-
-
-
@Gordon I'll do that right now. In the mean time is it possible to allow the http request on the Espruino to accept null for the key and cert?
-
I have been playing around with Node.js and I came across this..... https://nodejs.org/api/https.html
key: Private key to use for SSL. Default null. passphrase: A string of passphrase for the private key or pfx. Default null. cert: Public x509 certificate to use. Default null. ca: A string, Buffer or array of strings or Buffers of trusted certificates in PEM format. If this is omitted several well known "root" CAs will be used, like VeriSign. These are used to authorize connections.
I built a client app.js and have been using both POST and GET to send information into a Google Form or direct to spreadsheet with these all left at default. So to answer your question it appears that the only thing needed is the CA.
-
Yeah so far that seems to be working. Ill post back after some more testing if anything comes up. Thanks guys