Community
cancel
Showing results for 
Search instead for 
Did you mean: 
LGran3
New Contributor I
975 Views

Unsuccessfully Loading .js Sources

Using the Edison Arduino breakout with usb sound card set up as default. Working with Timbre.js and Cylon to get a button to trigger a .wav file. I am using socket.io and am able to connect to the socket and see that I am pushing the button.

But am having trouble loading the .js sources. I've tried moving the files around and changing the directory paths in my index.html file.

I am running app.js from my root, where my index.html and drumkit.wav is. My .js files are in a folder called js in my root. I am using Chrome.

My paths are written as such:

I go to my device page in Chrome and open the javascript console tool. It tells me that the server is saying that it's not found.

GET http://192.168.1.2:8080/js/playsounds.js http://192.168.1.2:8080/js/playsounds.js

GET http://192.168.1.2:8080/js/timbre.dev.js http://192.168.1.2:8080/js/timbre.dev.js

GET http://192.168.1.2:8080/js/subcollider.js http://192.168.1.2:8080/js/subcollider.js 404 (Not Found)

I've been trying things for hours, not sure what I am missing here.

Any ideas?

Thank you!

Tags (1)
3 Replies
Pablo_M_Intel
Employee
72 Views

Hi postITnote,

Did you try erasing the js folder and putting the .js files directly in your root? Also, you can try changing the name of the folder that contains these files, instead of using js why don't you try with scripts or something similar.

You can also change the name of the source to src="home/root/scripts/playsounds.js" and so on, just to see if you get a different result.

Regards,

PabloM_Intel

LGran3
New Contributor I
72 Views

Thanks PabloM_Intel,

It turns out I was missing this line of code

app.use(express.static(__dirname + '/public'))

I am having great difficulty figuring out how to use socket messages outside of functions to alter webpages. For example I have a potentiometer hooked up and am getting values in the javascript console over the socket connection. I am trying to use those values to move a slider on my index.html page.

Here is the code snippet. I have now that is printing values to the console with the creation of the slider and it's attributes.

socket.on('analogSensor', function(analogVal){

console.log('sensor value', analogVal)

})

new Interface.Slider({

drag : function(value){

frequency.rampTo(value, 0.1);

},

start : function(){

Tone.Master.mute = false;

},

end: function(){

Tone.Master.mute = true;

},

name : "frequency",

min : 0,

max : 1,

exp : 0.5,

value : .5,

position: 5

});

 

 

I would like to take the analogVal and use it to change the frequency.rampTo value. I've been looking all over the web for days and can't find a way to get the analog values out from the socket.on function.
Reply