This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Basic Digital Read and Rotary Phone Dial Reader | |
* ------------------ | |
* This code reads whether the phone is on the hook by treating that hook like a button that is either open or depressed | |
AND it reads out the number dialed on a rotary phone dial by counting the pulses made by the spinning dial wheel. | |
*/ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setup() { | |
createCanvas(800, 800); | |
for(var i=0;i<10;i++) { | |
if(i % 3 == 0) { | |
arrow(50, 50, 10, color(255, 0, 100)); | |
} | |
else { | |
arrow(50, 50, 10, color(150, 0, 255)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setup() { | |
} | |
function draw() { | |
drawMouseCoordinates(); | |
} | |
function drawMouseCoordinates() { | |
push(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*The Modulus operator! Remember in math when you didn't know how to use decimals, and you used to divide things | |
like 5%4= 1, remainder 1? Modulus is that, the remainder. | |
*/ | |
var a = 5 % 4; // Sets 'a' to 1 | |
var b = 125 % 100; // Sets 'b' to 25 | |
var c = 285.5 % 140.0; // Sets 'c' to 5.5 | |
var d = 30.0 % 33.0; // Sets 'd' to 30.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This sketch draws a row of pink donuts. | |
//lots of variables up here. | |
var x = 70; | |
var y = 200; | |
var diameter = 100; | |
var hole = 40; | |
var r = 200; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Im typing something here | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//paste all your code | |
// make sure you don't forget the top or the bottom of your code. if you do that, it won't work. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This sketch draws a row of pink donuts. | |
//donut object | |
var donut = { | |
x:70, | |
y:200, | |
diameter:100, | |
hole:40 | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This sketch draws a row of pink donuts. | |
//donut object | |
var donut = { | |
x:70, | |
y:200, | |
diameter:100, | |
hole:40 | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This sketch draws a pink donut that moves across the screen. | |
//donut object | |
var donut = { | |
x:70, | |
y:200, | |
diameter:100, | |
hole:40 | |
}; |
OlderNewer