Permalink
Browse files

Examples!

1 parent edd92ac commit ce4d4bf7c92864a6c76f61bddf10b62b8d2c0747 @sarahgp committed Aug 29, 2015
View
@@ -12,6 +12,8 @@ If you feel someone has violated this code or is otherwise making the community
### Claiming a Task
If you'd like to contribute to p5bots developement, check out the [issues](https://github.com/sarahgp/p5bots/issues) or open your own to let us know what you want to work on.
+Also, examples are always appreciated. See [the examples repo](examples) for what we already have.
+
### Prerequisities
1. Node.js
2. Npm
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,5 +1,5 @@
// Basic: Digital Read
-// Diagram:
+// Diagram: diagrams/simple_button
// Board setup — you may need to change the port
var b = p5.board('/dev/cu.usbmodem1421', 'arduino');
@@ -17,7 +17,6 @@ var p = b.pin(9, 'DIGITAL', 'INPUT');
p.read(function(val){console.log(val);});
function setup() {
- createCanvas(300, 200);
var innerStr = '<p style="font-family:Arial;font-size:12px">'
innerStr += 'Check out the console for readings</p>';
@@ -21,8 +21,13 @@ function setup() {
p = b.pin(9, 'DIGITAL', 'INPUT');
p.read();
- createCanvas(1200, 500);
+ createCanvas(1200, 300);
noStroke();
+
+ var innerStr = '<p style="font-family:Arial;font-size:12px">'
+ innerStr += 'Press the button</p>';
+
+ createDiv(innerStr);
}
function draw() {
@@ -1,5 +1,5 @@
// Basic: Light LED
-// Diagram: diagrams/simple_button
+// Diagram: diagrams/led
// Board setup — you may need to change the port
@@ -1,5 +1,5 @@
// Basic: Light LED + p5.DOM
-// Diagram: diagrams/simple_button
+// Diagram: diagrams/led
// Board setup — you may need to change the port
@@ -1,5 +1,5 @@
// Basic: PWM LED + Slider
-// Diagram: diagrams/simple_button
+// Diagram: diagrams/led
// Board setup — you may need to change the port
@@ -23,7 +23,7 @@ function setup() {
var innerStr = '<p style="font-family:Arial;font-size:12px">'
innerStr += '<b>&larr;</b> Motor on &nbsp; | &nbsp;';
innerStr += '<b>&rarr;</b> Motor off &nbsp; | &nbsp;';
- innerStr += '<b>&uarr;</b> Motor 100 </p>';
+ innerStr += '<b>&uarr;</b> motor.write(100) </p>';
createDiv(innerStr);
}
@@ -57,6 +57,6 @@ function setup() {
button.read();
button.pressed(redEllipse);
button.released(blueEllipse);
- button.held(greenEllipse, 3000);
+ button.held(greenEllipse, 1000);
}
@@ -40,7 +40,7 @@ function keyPressed() {
console.log(thermo.C);
} else if (keyCode === UP_ARROW) {
console.log('v');
- console.log(thermo);
+ console.log(thermo.val);
} else if (keyCode === DOWN_ARROW) {
console.log('k')
console.log(thermo.K);
@@ -1,5 +1,5 @@
-// Button: Button
-// Diagram: diagrams/simple_button
+// Piezo: Button
+// Diagram: diagrams/tone
// Board setup — you may need to change the port
@@ -1,5 +1,5 @@
-// Button: Button
-// Diagram: diagrams/simple_button
+// Piezo: Knock
+// Diagram: diagrams/knock
// Board setup — you may need to change the port
View
@@ -10,7 +10,7 @@
<script src="/p5_scripts/p5.dom.js"></script>
<script src="/p5_scripts/p5bots.js"></script>
<!-- Swap out the script below with any of the others in example_scripts. -->
- <script src="/example_scripts/01_basics/04_LightLED.js"></script>
+ <script src="/example_scripts/08_piezo&tone&knock/02_Knock.js"></script>
</body>
</html>
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ce4d4bf

Please sign in to comment.