• No results found

Aantekeningen gesprekken na gebruik

7. Conclusies 1 Conclusie

9.3 Aantekeningen gesprekken na gebruik

Hieronder volgen samengevoegde aantekeningen van de gesprekken achteraf. Opmerkingen met overeenkomstige strekking zijn samengevoegd en de getallen geven aan hoeveel bezoekers (of groepjes) dit ongeveer zeiden.

Meningen/opmerkingen over de video’s

Mooie filmpjes. (12) Leuk om te zien.(8) Grappig om te zien.(1) Het ging wat snel. (4) Is dat hier opgenomen?(1)

Bijzonder/apart dat ze aangaan met de gitaren oppakken! (3)

Over de inhoud

Ja, leuk om te zien dat jullie dat allemaal doen! (5)

Ik moet hem nog een keertje kijken, ik weet nog niet precies wat er gebeurde.(3)

Interessant om te zien, dit wist ik niet! (12) Het is leuker/beter dan een verkooppraatje!(11)

Toevoeging aan de winkel

Ja het past hier wel, er staan zoveel aparte dingen. (3) Het is wel heel bijzonder, dit zie je nergens! (8) Het is weer eens wat anders dan een saai schap. (5)

Ik snap niet helemaal waarom ze moeten bewegen, vind het een beetje raar. (1)

Uniekheid, andere ervaringen

Nog niet eerder gezien zoiets! (11)

dat is toch anders (reageren niet op je). (3)

Wel eens een wand met schoenen gezien toen ik op vakantie was. Als je een schoen pakte zag je ook iets gebeuren op een scherm. (1)

9.4 Programma broncodes

Arduino code // SERVO VARIABLES --- #include <Servo.h> // Servo’s Servo servo_0; Servo servo_1; // Pins int servoPin_0 = 9; int servoPin_1 = 10; // Position int pos[] = {0, 0}; int write_pos; // Direction int current_position[] = {0, 0}; int moving[] = {0, 0}; // Counter int pos_counter[] = {0, 0}; // Boundaries

int boundary = 80;// <<< DISTANCE IN CM!!!

int wait = 4000; int top = 130; int bottom = 40; // HCSR04 VARIABLES --- // Pins int trigPin_0 = 8; int trigPin_1 = 13; int echoPin_0 = 7; int echoPin_1 = 12; // Distance long distance[2]; // LDR VARIABLES --- // Analog pins int LDR_0 = A0; int LDR_1 = A1;

// Lower boundary ints

int low_0;

int low_1;

// Minimum difference between low and high

int diff_0 = 80; int diff_1 = 80; // On or off int states[] = {0, 0}; // SETUP ============================ void setup(){

// Start serial communication

Serial.begin(9600);

// Set pins for HCSR04

pinMode(trigPin_0, OUTPUT);

pinMode(trigPin_1, OUTPUT);

pinMode(echoPin_0, INPUT);

pinMode(echoPin_1, INPUT); // Attach Servo and put in start position

servo_0.attach(servoPin_0); servo_1.attach(servoPin_1); pos[0] = bottom;

pos[1] = bottom;

// Set low the first time for LDR

low_0 =analogRead(LDR_0); low_1 =analogRead(LDR_1); }

// LOOP =============================

void loop(){

// Read the LDR, check for a new low and update the state for both pins //--- LDR pin 0 ---//

int val =analogRead(LDR_0); low_0 = check_low(val,low_0);

states[0] = read_LDR(low_0, diff_0, val, states[0]);

//--- LDR pin 1 ---//

val =analogRead(LDR_1);

low_1 = check_low(val,low_1);

states[1] = read_LDR(low_1, diff_1, val, states[1]);

// Send the switch states in binary

unsigned int state_bin = (states[1] << 1) | states[0] ;

Serial.println(state_bin);

// Get the distance from the HCSR04’s and activate the servo’s (only when guitar is in s

distance[0] = get_distance(trigPin_0, echoPin_0); distance[1] = get_distance(trigPin_1, echoPin_1);

// Calculate the new servo position and move the servo’s

write_pos = servo_action(0); servo_0.write(write_pos); write_pos = servo_action(1); servo_1.write(write_pos);

delay(50); }

// FUNCTIONS --- // Function to calculate the servo position and action

int servo_action(int i){

// Set the position to move to

if(moving[i] == 1){

// If the servo is not in top position and the guitar is in the stand

if(current_position[i] == 0 && states[i] == 0) {

// Keep moving

if(pos[i] < top){ pos[i] += 8;

t

// Stop the movement, set the variables accordingly

}else {

moving[i] = 0;

current_position[i] = 1; }

// If the servo is not in the bottom position

}else if(current_position[i] == 1){

// Keep moving back

if(pos[i] > bottom){ pos[i] -= 5;

// Stop moving back, set the variables in start position }else { moving[i] = 0; current_position[i] = 0; pos_counter[i] = 0; } }

// If the servo is not moving

}else {

// If the guitar is in beginposition and the distance is within reach, start moving

if(current_position[i] == 0){

if(distance[i] < boundary){ moving[i] = 1;

}

// If the guitar is in endposition and the waiting is done, start moving back. The wai

}else { if(pos_counter[i] == (wait/50)) { moving[i] = 1; } pos_counter[i]++; } } return pos[i]; }

// Function to measure distance from HCSR04

long get_distance(int trigger,int echo) {

digitalWrite(trigger, LOW);

delayMicroseconds(2);

digitalWrite(trigger, HIGH);

delayMicroseconds(10);

digitalWrite(trigger, LOW);

long duration =pulseIn(echo, HIGH);

long distance = duration/58.2;

// Bring down accidental high values if(distance > 1000){ distance = boundary; } return (distance); }

// Function to read LDR and return a state t

int read_LDR(int low,int diff,int value,int

curr_state){

// Check for a value

if(value > 0){

/* If there is at least a difference of diff between

the value and the low, state = 1, otherwise state = 0 */

if(value - low >= diff){

return 1; }else {

return 0; } }else {

// Return the current value if there is no value

return curr_state; } }

// Function to check if there is a new low

int check_low(int value,int low){

int result = low;

// Check if there is a value

if(value > 0){

// If the value is lower then low, it becomes the new low

if(value < low){ result = value; } } return result; } Node.js code /* serialServer.js

a node.js app to read serial strings and send them to webSocket clients

requires: * node.js (http://nodejs.org/) * express.js (http://expressjs.com/) * socket.io (http://socket.io/#how-to- use) * serialport.js (https://github.com/ voodootikigod/node-serialport)

based on the core examples for socket.io and serialport.js

created 21 Aug 2012

modified 19 Jan 2014 by Tom Igoe

Patches and improvements suggested by Steve Klise, Lia Martinez, and Will Jennings

*/

var serialport = require(“serialport”), // include the serialport library

SerialPort = serialport.SerialPort, // make a local instance of serial

express = require(‘express’), // make an instance of express

url = ‘http://localhost:8080’; // URL to open in the browser

var app = express(), // start Express framework server = require(‘http’).createServer(app), // start an HTTP server

io = require(‘socket.io’).listen(server); // listen for websocket requests

// third word of the command line is serial port name:

var portName = process.argv[2];

// print out the port you’re listening on:

console.log(“opening serial port: “ + portName); // listen for incoming requests on the server: server.listen(8080);

console.log(“Listening for new clients on port 8080”);

// open the serial port:

var myPort = new SerialPort(portName, {

// look for return and newline at the end of each data packet:

parser: serialport.parsers.readline(“\r\n”) });

app.use(express.static(__dirname + ‘/’));

// respond to web GET requests with the index.html page:

app.get(‘/’, function(request, response) {

response.sendfile(__dirname + ‘/index.html’); });

// listen for new socket.io connections:

io.sockets.on(‘connection’, function(socket) { // if there’s a socket client, listen for new serial data:

myPort.on(‘data’, function(data) {

// for debugging, you should see this in Terminal:

console.log(data);

// send a serial event to the web client with the data:

socket.emit(‘serialEvent’, data); }); }); Javascript + HTML + CSS handle_videos.js $(function() { //Variables needed var count_activity_max = 1000; var count_activity = 0;

var currently_playing = null;

// Set media to the width and height of the screen

$(“video, img”).attr(“width”, $(“html”). width());

$(“video, img”).attr(“height”, $(“html”). height());

// Open a connection to the serial server: var socket = io.connect(‘http://

localhost:8080’);

var outputValue = false; // value to send to the server

// when you get a serialdata event, do this: socket.on(‘serialEvent’, function(data) {

// set the stuff inside the element’s HTML tags to

// whatever the ‘value’ property of the received data is:

states = []; if (data == 0) { states = [0, 0]; } if (data == 1) { states = [0, 1]; } if (data == 2) {

} if (data == 3) { states = [1, 1]; } handle_states(states); });

// Function to reset the video’s in their initial state function reset_video() { $(“video”).addClass(“dark”); $(“#video_0”)[0].currentTime = 0; $(“#video_1”)[0].currentTime = 0; }

// Handle the states

function handle_states(states) { // Loop through the states

$.each(states, function(i, state) { $video = $(“#video_” + i);

// If the guitar is not picked up if (state == 0) {

// Pause the video $video[0].pause();

// If it was playing before, set set currently_playing to null

if (currently_playing == i) { currently_playing = null; }

// If the guitar is picked up

} else {

// Only start playing if the state is the only one that is on

if (state_is_alone(states, i)) { currently_playing = i;

// Put the video on top and remove the dark class and hide the pause screen $(“video”).css(“z-index”, 0); $video.css(“z-index”, 1); $video.removeClass(“dark”); $(“#pause”).hide();

// Play the video $video[0].play(); }

} });

// If all guitars are in the stands if (currently_playing == null) { // Show the pause screen $(“#pause”).show();

// Add to the activity counter count_activity++;

// If at least 1 guitar is picked up, set the counter to 0

} else {

count_activity = 0; }

// If the guitars are in the stand for a while, reset the video’s and count again.

reset_video(); count_activity = 0; }

}

// Function to check if the state is the only one on

function state_is_alone(states, i) { alone = true;

$.each(states, function(j, state) { if (j != i && state == 1) { alone = false; } }); return alone; } }); index.html <!DOCTYPE html> <html> <head>

<link rel=”stylesheet” href=”css/style.css”> <script src=”/socket.io/socket.io.js”></ script> <script src=”js/jquery.min.js”></script> <script src=”js/handle_video.js”></script> </head> <body>

<video id=”video_0” class=”dark” preload=”auto”>

mp4”>

</video>

<video id=”video_1” class=”dark” preload=”auto”> <source src=”video/electric.mp4”

type=”video/mp4”> </video>

<img id=”pause” src=”image/pause2.png” /> </body> </html> style.css html{ position: relative; width: 1920px; height: 1080px; overflow: hidden; } body{ background-color: #000; } video, img { position: absolute; top:0; } .dark { opacity: 0; } img#pause { z-index: 3; }