Difference between revisions of "Team:Cambridge-JIC/Make Your Own js"
m |
|||
Line 160: | Line 160: | ||
ret += '</table>' | ret += '</table>' | ||
− | ret += '<br/><table><tr><th colspan="4" style="text-align:center">OFF-THE-SHELF COMPONENTS</th></tr><tr><th>Number</th><th>Part</th><th>Cost (GBP)</th><th>Description/Provider</th></tr><tr><td>~5</td><td>bright-field LEDs</td></tr><tr><td>??</td><td>lenses</td></tr><tr><td>2</td><td>25 mm long M4 screws</td></tr><tr><td>1</td><td>40 mm long M4 screw</td></tr><tr><td>3</td><td>M4 nuts + washers</td></tr><tr><td>1</td><td>Raspberry Pi 2 Model B</td></tr><tr><td>1</td><td>Ralink RT5370 WiFi adapter</td></tr><tr><td>1</td><td>Arduino UNO with its USB B connector</td></tr><tr><td>1</td><td>breadboard</td></tr><tr><td>1</td><td>16GB micro SD card | + | ret += '<br/><table><tr><th colspan="4" style="text-align:center">OFF-THE-SHELF COMPONENTS</th></tr><tr><th>Number</th><th>Part</th><th>Cost (GBP)</th><th>Description/Provider</th></tr><tr><td>~5</td><td>bright-field LEDs</td></tr><tr><td>??</td><td>lenses</td></tr><tr><td>2</td><td>25 mm long M4 screws</td></tr><tr><td>1</td><td>40 mm long M4 screw</td></tr><tr><td>3</td><td>M4 nuts + washers</td></tr><tr><td>1</td><td>Raspberry Pi 2 Model B</td></tr><tr><td>1</td><td>Ralink RT5370 WiFi adapter</td></tr><tr><td>1</td><td>Arduino UNO with its USB B connector</td></tr><tr><td>1</td><td>breadboard</td></tr><tr><td>1</td><td>16GB micro SD card</td></tr><tr><td>1</td><td>RPi camera with its ribbon cable</td></tr><tr><td>1</td><td>20 ohm resistor</td></tr><tr><td>1</td><td>ethernet cable</td></tr><tr><td>??</td><td>insulated single-core wire</td></tr>' |
if(options[2] == 0) { | if(options[2] == 0) { | ||
− | ret += '<tr><td>~5</td><td>LEDs for GFP</td></tr>' | + | ret += '<tr><td>~5</td><td>LEDs for GFP</td></tr><tr><td>1</td><td>dichroic mirror for GFP</td></tr><tr><td>1</td><td>excitation filter for GFP</td></tr><tr><td>1</td><td>emission filter for GFP</td></tr>' |
+ | } | ||
+ | if(options[3] == 0) { | ||
+ | ret += '<tr><td>~5</td><td>LEDs for RFP</td></tr><tr><td>1</td><td>dichroic mirror for RFP</td></tr><tr><td>1</td><td>excitation filter for RFP</td></tr><tr><td>1</td><td>emission filter for RFP</td></tr>' | ||
+ | } | ||
+ | if(options[4] == 0) { | ||
+ | ret += '<tr><td>~5</td><td>LEDs for ?FP</td></tr><tr><td>1</td><td>dichroic mirror for ?FP</td></tr><tr><td>1</td><td>excitation filter for ?FP</td></tr><tr><td>1</td><td>emission filter for ?FP</td></tr>' | ||
+ | } | ||
+ | if(options[5] == 1 || options[5] == 2) { | ||
+ | ret += '<tr><td>3</td><td>stepper motors</td></tr><tr><td>2</td><td>UNL2003A Darlington driver chips</td></tr>' | ||
+ | } | ||
+ | if((options[5] == 1 || options[5] == 2) && options[6] == 1) { | ||
+ | ret += '<tr><td>1</td><td>9V battery connector</td></tr>' | ||
+ | } | ||
+ | if((options[5] == 1 || options[5] == 2) && options[6] == 0) { | ||
+ | ret += '<tr><td>2</td><td>9V battery connectors</td></tr>' | ||
+ | } | ||
+ | if(options[6] == 0 && !(options[5] == 1 || options[5] == 2)) { | ||
+ | ret += '<tr><td>1</td><td>9V battery connector</td></tr>' | ||
+ | } | ||
+ | if(options[6] == 0) { | ||
+ | ret += '<tr><td>1</td><td>1 MoPi power board</td></tr>' | ||
+ | } | ||
+ | if(options[6] == 1) { | ||
+ | ret += '<tr><td>1</td><td>2A micro USB power cable</td></tr>' | ||
} | } | ||
ret += '</table>' | ret += '</table>' |
Revision as of 11:02, 15 September 2015
quiz = function(elem){ this.elem = $(elem); this.steps = [];
this.step = function(question, answers) { this.question = question; this.answers = {}; this.bind = function(target, keys) { if (typeof keys === "undefined") { keys = Object.keys(this.answers); }
for (var i=0; i<keys.length; i++) { key = keys[i]; this.answers[key].target = target; } }; this.elem = function(quiz, index) {elem = $('
');
elem.append($('').text(this.question));
for (key in this.answers) {
elem.append($('
').text(this.question));
for (key in this.answers) {
elem.append($('')
.text(this.answers[key].answer)
.data("key", key)
.data("step", this)
.data("quiz", quiz)
.data("index", index)
.click(function(){
key = $(this).data("key");
step = $(this).data("step");
quiz = $(this).data("quiz");
index = $(this).data("index");
ref = quiz.steps[index];
ref.elem.find('.cam-quiz-selected').removeClass('cam-quiz-selected');
$(this).addClass('cam-quiz-selected');
for (var i=quiz.steps.length; --i>index;) {
quiz.steps[i].elem.remove();
quiz.steps.pop();
}
quiz.steps[index].option = key;
nstep = step.answers[key].target;
switch (typeof nstep) {
case "object":
var nindex = quiz.steps.length;
var nref = {
'step': nstep,
'elem': nstep.elem(quiz, nindex),
'option': undefined
};
quiz.steps.push(nref);
quiz.elem.append(nref.elem);
break;
case "function":
options = [];
for (var i=0; i<quiz.steps.length; i++) {
options.push(quiz.steps[i].option);
}
var nref = {
'step': undefined,
'elem': $('')
.append(nstep(options)),
'option': undefined
};
quiz.steps.push(nref);
quiz.elem.append(nref.elem);
break;
default:
alert("Quiz error! Please contact the site maintainers....");
break;
}
}));
}
return elem;
};
for (key in answers) {
answer = answers[key];
this.answers[key] = {
'answer': answer,
'target': undefined
};
}
};
this.start = function(step) {
index = this.steps.length;
ref = {
'step': step,
'elem': step.elem(this, index),
'option': undefined
};
this.steps.push(ref);
this.elem.append(ref.elem);
};
};
$(document).ready(function(){
q = new quiz('#cam-quiz');
step0 = new q.step("Tell us which options you'd like for your microscope.", {
1: "Okay!"
});
step1 = new q.step("Besides bright-field, do you need dark-field imaging?", {
0: "Yes",
1: "No"
});
step2 = new q.step("Do you need to image GFP fluorescence?", {
0: "Yes",
1: "No"
});
step3 = new q.step("Do you need to image RFP fluorescence?", {
0: "Yes",
1: "No"
});
step4 = new q.step("Do you need to image other fluorescent proteins, e.g. YFP?", {
0: "Yes",
1: "No"
});
step5 = new q.step("Do you want your microscope to be manual, motorised, or will you need to swap between both?", {
0: "Manual only",
1: "Motorised only",
2: "Both",
});
step6 = new q.step("Do you need your microscope to be fully battery-powered, e.g. for fieldwork?", {
0: "Yes",
1: "No"
});
final = function(options) {
window.location.href="#CC0";
ret = '<h3>Thanks!</h3>
3D PRINTED COMPONENTS Number Part Cost (GBP) STL file SCAD file 1 main stage 3 legs 2 side supports for z axis 1 z axis in 3 parts (vertical + horizontal + connector) 1 connecting ring bw z axes 1 3-legged camera holder 2 slide clips 1 bright-field cube '
if(options[1] == 0) {
ret += '1 dark-field tube in N parts '
}
if(options[2] == 0 && options[3] == 0 && options[4] == 0) {
ret += '3 epicubes 3 drawers for the excitation filters 3 drawers for the emission filters 3 drawers for the dichroic mirrors '
}
else if((options[2] == 0 && options[3] == 0) || (options[2] == 0 && options[4] == 0) || (options[3] == 0 && options[4] == 0)) {
ret += '2 epicubes 2 drawers for the excitation filters 2 drawers for the emission filters 2 drawers for the dichroic mirrors '
} else if(options[2] == 0 || options[3] == 0 || options[4] == 0) {
ret += '1 epicube 1 drawer for the excitation filter 1 drawer for the emission filter 1 drawer for the dichroic mirror '
}
if(options[5] == 0 || options[5] == 2) {
ret += '3 screw gears 3 manual gears 3 screw holders '
}
if(options[5] == 1 || options[5] == 2) {
ret += '3 screw gears for motors 3 motor holders '
}
if((options[5] == 1 || options[5] == 2) && options[6] == 1) {
ret += '1 battery holder for RPi '
}
if((options[5] == 1 || options[5] == 2) && options[6] == 0) {
ret += '2 battery holders for RPi '
}
if(options[6] == 0 && !(options[5] == 1 || options[5] == 2)) {
ret += '1 battery holder for RPi '
}
ret += '
'
ret += '
OFF-THE-SHELF COMPONENTS Number Part Cost (GBP) Description/Provider ~5 bright-field LEDs ?? lenses 2 25 mm long M4 screws 1 40 mm long M4 screw 3 M4 nuts + washers 1 Raspberry Pi 2 Model B 1 Ralink RT5370 WiFi adapter 1 Arduino UNO with its USB B connector 1 breadboard 1 16GB micro SD card 1 RPi camera with its ribbon cable 1 20 ohm resistor 1 ethernet cable ?? insulated single-core wire '
if(options[2] == 0) {
ret += '~5 LEDs for GFP 1 dichroic mirror for GFP 1 excitation filter for GFP 1 emission filter for GFP '
}
if(options[3] == 0) {
ret += '~5 LEDs for RFP 1 dichroic mirror for RFP 1 excitation filter for RFP 1 emission filter for RFP '
}
if(options[4] == 0) {
ret += '~5 LEDs for ?FP 1 dichroic mirror for ?FP 1 excitation filter for ?FP 1 emission filter for ?FP '
}
if(options[5] == 1 || options[5] == 2) {
ret += '3 stepper motors 2 UNL2003A Darlington driver chips '
}
if((options[5] == 1 || options[5] == 2) && options[6] == 1) {
ret += '1 9V battery connector '
}
if((options[5] == 1 || options[5] == 2) && options[6] == 0) {
ret += '2 9V battery connectors '
}
if(options[6] == 0 && !(options[5] == 1 || options[5] == 2)) {
ret += '1 9V battery connector '
}
if(options[6] == 0) {
ret += '1 1 MoPi power board '
}
if(options[6] == 1) {
ret += '1 2A micro USB power cable '
}
ret += '
'
return $('').html(ret)
}
step0.bind(step1, [1]);
step1.bind(step2, [0]);
step1.bind(step2, [1]);
step2.bind(step3, [0]);
step2.bind(step3, [1]);
step3.bind(step4, [0]);
step3.bind(step4, [1]);
step4.bind(step5, [0]);
step4.bind(step5, [1]);
step5.bind(step6, [0]);
step5.bind(step6, [1]);
step5.bind(step6, [2]);
step6.bind(final, [0]);
step6.bind(final, [1]);
q.start(step0);
});
.text(this.answers[key].answer) .data("key", key) .data("step", this) .data("quiz", quiz) .data("index", index) .click(function(){ key = $(this).data("key"); step = $(this).data("step"); quiz = $(this).data("quiz"); index = $(this).data("index"); ref = quiz.steps[index]; ref.elem.find('.cam-quiz-selected').removeClass('cam-quiz-selected'); $(this).addClass('cam-quiz-selected');
for (var i=quiz.steps.length; --i>index;) { quiz.steps[i].elem.remove(); quiz.steps.pop(); }
quiz.steps[index].option = key; nstep = step.answers[key].target; switch (typeof nstep) { case "object": var nindex = quiz.steps.length; var nref = { 'step': nstep, 'elem': nstep.elem(quiz, nindex), 'option': undefined }; quiz.steps.push(nref); quiz.elem.append(nref.elem); break; case "function": options = []; for (var i=0; i<quiz.steps.length; i++) { options.push(quiz.steps[i].option); } var nref = { 'step': undefined,'elem': $('
')
'
ret += '
'
return $('
.append(nstep(options)), 'option': undefined }; quiz.steps.push(nref); quiz.elem.append(nref.elem); break; default: alert("Quiz error! Please contact the site maintainers...."); break; } })); } return elem; };
for (key in answers) { answer = answers[key]; this.answers[key] = { 'answer': answer, 'target': undefined }; } };
this.start = function(step) { index = this.steps.length; ref = { 'step': step, 'elem': step.elem(this, index), 'option': undefined }; this.steps.push(ref); this.elem.append(ref.elem); }; };
$(document).ready(function(){ q = new quiz('#cam-quiz');
step0 = new q.step("Tell us which options you'd like for your microscope.", { 1: "Okay!" }); step1 = new q.step("Besides bright-field, do you need dark-field imaging?", { 0: "Yes", 1: "No" }); step2 = new q.step("Do you need to image GFP fluorescence?", { 0: "Yes", 1: "No" }); step3 = new q.step("Do you need to image RFP fluorescence?", { 0: "Yes", 1: "No" }); step4 = new q.step("Do you need to image other fluorescent proteins, e.g. YFP?", { 0: "Yes", 1: "No" }); step5 = new q.step("Do you want your microscope to be manual, motorised, or will you need to swap between both?", { 0: "Manual only", 1: "Motorised only", 2: "Both", }); step6 = new q.step("Do you need your microscope to be fully battery-powered, e.g. for fieldwork?", { 0: "Yes", 1: "No" });
final = function(options) {
window.location.href="#CC0";ret = '<h3>Thanks!</h3>
3D PRINTED COMPONENTS | ||||
---|---|---|---|---|
Number | Part | Cost (GBP) | STL file | SCAD file |
1 | main stage | |||
3 | legs | |||
2 | side supports for z axis | |||
1 | z axis in 3 parts (vertical + horizontal + connector) | |||
1 | connecting ring bw z axes | |||
1 | 3-legged camera holder | |||
2 | slide clips | |||
1 | bright-field cube | |||
1 | dark-field tube in N parts | |||
3 | epicubes | |||
3 | drawers for the excitation filters | |||
3 | drawers for the emission filters | |||
3 | drawers for the dichroic mirrors | |||
2 | epicubes | |||
2 | drawers for the excitation filters | |||
2 | drawers for the emission filters | |||
2 | drawers for the dichroic mirrors | |||
1 | epicube | |||
1 | drawer for the excitation filter | |||
1 | drawer for the emission filter | |||
1 | drawer for the dichroic mirror | |||
3 | screw gears | |||
3 | manual gears | |||
3 | screw holders | |||
3 | screw gears for motors | |||
3 | motor holders | |||
1 | battery holder for RPi | |||
2 | battery holders for RPi | |||
1 | battery holder for RPi |
OFF-THE-SHELF COMPONENTS | |||
---|---|---|---|
Number | Part | Cost (GBP) | Description/Provider |
~5 | bright-field LEDs | ||
?? | lenses | ||
2 | 25 mm long M4 screws | ||
1 | 40 mm long M4 screw | ||
3 | M4 nuts + washers | ||
1 | Raspberry Pi 2 Model B | ||
1 | Ralink RT5370 WiFi adapter | ||
1 | Arduino UNO with its USB B connector | ||
1 | breadboard | ||
1 | 16GB micro SD card | ||
1 | RPi camera with its ribbon cable | ||
1 | 20 ohm resistor | ||
1 | ethernet cable | ||
?? | insulated single-core wire | ||
~5 | LEDs for GFP | ||
1 | dichroic mirror for GFP | ||
1 | excitation filter for GFP | ||
1 | emission filter for GFP | ||
~5 | LEDs for RFP | ||
1 | dichroic mirror for RFP | ||
1 | excitation filter for RFP | ||
1 | emission filter for RFP | ||
~5 | LEDs for ?FP | ||
1 | dichroic mirror for ?FP | ||
1 | excitation filter for ?FP | ||
1 | emission filter for ?FP | ||
3 | stepper motors | ||
2 | UNL2003A Darlington driver chips | ||
1 | 9V battery connector | ||
2 | 9V battery connectors | ||
1 | 9V battery connector | ||
1 | 1 MoPi power board | ||
1 | 2A micro USB power cable |
').html(ret)
}
step0.bind(step1, [1]);
step1.bind(step2, [0]); step1.bind(step2, [1]);
step2.bind(step3, [0]); step2.bind(step3, [1]);
step3.bind(step4, [0]); step3.bind(step4, [1]);
step4.bind(step5, [0]); step4.bind(step5, [1]);
step5.bind(step6, [0]); step5.bind(step6, [1]); step5.bind(step6, [2]);
step6.bind(final, [0]); step6.bind(final, [1]); q.start(step0);});