Slides are here:
http://mhellar.github.io/physcomp2/1
Grab the code here:
https://bit.ly/2sfx2Bm
The HC-SR04 ultrasonic sensor uses sonar to determine distance to an object like bats do. It offers excellent non-contact range detection with high accuracy and stable readings in an easy-to-use package. From 2cm to 400 cm or 1” to 13 feet. It operation is not affected by sunlight or black material like Sharp rangefinders are (although acoustically soft materials like cloth can be difficult to detect). It comes complete with ultrasonic transmitter and receiver module.
Upload the Arduino sketch in hc-04-code/hc-04 and then check the output in the serial monitor
Open hc04_p5js in a text editor and the terminal. Change the port. NPM install. Make slight change to Arduino code. Node app.js and open localhost:3000 in your browser
ADXL354 accelerometer
An accelerometer is an electromechanical device that will measure acceleration forces. These forces may be static, like the constant force of gravity pulling at your feet, or they could be dynamic - caused by moving or vibrating the accelerometer.By measuring the amount of static acceleration due to gravity, you can find out the angle the device is tilted at with respect to the earth. By sensing the amount of dynamic acceleration, you can analyze the way the device is moving.
ADXL354 accelerometer
Johnny-Five is the original JavaScript Robotics programming framework. Released by Bocoup in 2012, Johnny-Five is maintained by a community of passionate software developers and hardware engineers. Over 75 developers have made contributions towards building a robust, extensible and composable ecosystem.
contents of package.json
{
"name": "J5_led_1",
"version": "1.0.0",
"description": "A Johnny Five LED app",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"johnny-five": "^0.8.106"
}
}
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
var led = new five.Led(6);
led.blink(500);
});
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
var led = new five.Led(6);
led.pulse(500);
});
Led Animations
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
var led = new five.Led(6);
led.pulse({
easing: "linear",
duration: 3000,
cuePoints: [0, 0.2, 0.4, 0.6, 0.8, 1],
keyFrames: [0, 10, 0, 50, 0, 255],
onstop: function() {
console.log("Animation stopped");
}
});
});
Reference
Update code in code/twitter-ard/app.js
var client = new Twitter({
consumer_key: 'Enter Here',
consumer_secret: 'Enter Here',
access_token_key: 'Enter Here',
access_token_secret: 'Enter Here'
})
Twitter API Reference
Update code in code/twitter-ard/app.js
var client = new Twitter({
consumer_key: 'Enter Here',
consumer_secret: 'Enter Here',
access_token_key: 'Enter Here',
access_token_secret: 'Enter Here'
})