hand in is tomorrow, hoping everything will look okay when I arrive in the morning.
have some exciting ideas about what next to do with the arduino, but not going to say yet until I've got them more figured out. will be good though!
Sunday, 31 May 2009
Tuesday, 26 May 2009
tuesday, 1 day til move, 3 days til deadline
lots and lots and lots of worry.
had to buy a last minute addition, a PIR sensor from Active-robots.co.uk to go with project two, the proverb machine. the buttons were just too clumsy and wanted something a little less touchy. the PIR sensor should be really quick to connect to 5V, GND & an14 so that's good.
Sketch will be as follows,
#include
#include
#include "util.h"
#include "wave.h"
AF_Wave card;
File f;
Wavefile wave;
#define playcomplete(x) ROM_playcomplete(PSTR(x))
#define DEBOUNCE 100
#define snsr 14 //sensor connected to analogue0
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Wave test!");
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(snsr, OUTPUT);
// enable pull-up resistors on
// switch pins (analog inputs)
digitalWrite(14, HIGH);
// open memory card
randomSeed(analogRead(0));
if (!card.init_card()) {
putstring_nl("Card init. failed!"); return;
}
if (!card.open_partition()) {
putstring_nl("No partition!"); return;
}
if (!card.open_filesys()) {
putstring_nl("Couldn't open filesys"); return;
}
if (!card.open_rootdir()) {
putstring_nl("Couldn't open dir"); return;
}
putstring_nl("Files found:");
ls();
}
void ls() {
char name[13];
int ret;
card.reset_dir();
putstring_nl("Files found:");
while (1) {
ret = card.get_next_name_in_dir(name);
if (!ret) {
card.reset_dir();
return;
}
Serial.println(name);
}
}
void pulseServo(uint8_t servopin, uint16_t p) {
digitalWrite(servopin, HIGH);
delayMicroseconds(600);
while (p--) {
delayMicroseconds(4);
}
digitalWrite(servopin, LOW);
delay(18);
}
uint8_t sensorstate = 0;
void loop() {
int distsensor, i;
long time;
/*
for (i=0; i<50; i++) {
pulseServo(servo,0);
}
for (i=0; i<50; i++) {
pulseServo(servo,400);
}
return;
*/
distsensor = 0;
for (i=0; i<8; i++) {
distsensor += analogRead(0);
delay(50);
}
distsensor /= 8;
putstring("Sensor = "); Serial.println(distsensor);
if (distsensor <= 10) {
digitalWrite(snsr, HIGH);
}
if (distsensor > 10) {
digitalWrite(snsr, LOW);
sensorstate = 1;
// nobody there. one out of 200 times play one of the sounds (once every few minutes)
i = random(200);
//Serial.println(i);
if (i == 0) {
i = random(3);
if (i == 0) {
playcomplete("rise so high.WAV");
} else if (i == 1) {
playcomplete("smoothseas.WAV");
} else if (i == 2) {
playcomplete("to climb steep hills.WAV");
} else {
playcomplete("exhalted throne.WAV");
}
}
} else if ((distsensor > 30) && (distsensor < 40)) {
if (sensorstate <= 1) { // play "smoothseas"
playcomplete("smoothseas.WAV");
} else {
i = random(60); // more often
//Serial.println(i);
if (i == 0) {
i = random(3);
if (i == 0) {
playcomplete("exhalted throne.WAV");
} else if (i == 1) {
playcomplete("to climb steep hills.WAV");
} else {
playcomplete("rise so high.WAV");
}
}
}
}
}
void ROM_playcomplete(const char *romname) {
char name[13], i;
uint8_t volume;
int v2;
for (i=0; i<13; i++) {
name[i] = pgm_read_byte(&romname[i]);
}
name[12] = 0;
Serial.println(name);
playfile(name);
while (wave.isplaying) {
volume = 0;
for (i=0; i<8; i++) {
v2 = analogRead(1) - 512;
if (v2 < 0)
v2 *= -1;
if (v2 > volume)
volume = v2;
delay(5);
}
}
//putstring("vol = "); Serial.println(volume, DEC);
}
void playfile(char *name) {
f = card.open_file(name);
if (!f) {
putstring_nl(" Couldn't open file"); return;
}
if (!wave.create(f)) {
putstring_nl(" Not a valid WAV"); return;
}
// ok time to play!
wave.play();
}
hope it's right!!
had to buy a last minute addition, a PIR sensor from Active-robots.co.uk to go with project two, the proverb machine. the buttons were just too clumsy and wanted something a little less touchy. the PIR sensor should be really quick to connect to 5V, GND & an14 so that's good.
Sketch will be as follows,
#include
#include
#include "util.h"
#include "wave.h"
AF_Wave card;
File f;
Wavefile wave;
#define playcomplete(x) ROM_playcomplete(PSTR(x))
#define DEBOUNCE 100
#define snsr 14 //sensor connected to analogue0
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Wave test!");
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(snsr, OUTPUT);
// enable pull-up resistors on
// switch pins (analog inputs)
digitalWrite(14, HIGH);
// open memory card
randomSeed(analogRead(0));
if (!card.init_card()) {
putstring_nl("Card init. failed!"); return;
}
if (!card.open_partition()) {
putstring_nl("No partition!"); return;
}
if (!card.open_filesys()) {
putstring_nl("Couldn't open filesys"); return;
}
if (!card.open_rootdir()) {
putstring_nl("Couldn't open dir"); return;
}
putstring_nl("Files found:");
ls();
}
void ls() {
char name[13];
int ret;
card.reset_dir();
putstring_nl("Files found:");
while (1) {
ret = card.get_next_name_in_dir(name);
if (!ret) {
card.reset_dir();
return;
}
Serial.println(name);
}
}
void pulseServo(uint8_t servopin, uint16_t p) {
digitalWrite(servopin, HIGH);
delayMicroseconds(600);
while (p--) {
delayMicroseconds(4);
}
digitalWrite(servopin, LOW);
delay(18);
}
uint8_t sensorstate = 0;
void loop() {
int distsensor, i;
long time;
/*
for (i=0; i<50; i++) {
pulseServo(servo,0);
}
for (i=0; i<50; i++) {
pulseServo(servo,400);
}
return;
*/
distsensor = 0;
for (i=0; i<8; i++) {
distsensor += analogRead(0);
delay(50);
}
distsensor /= 8;
putstring("Sensor = "); Serial.println(distsensor);
if (distsensor <= 10) {
digitalWrite(snsr, HIGH);
}
if (distsensor > 10) {
digitalWrite(snsr, LOW);
sensorstate = 1;
// nobody there. one out of 200 times play one of the sounds (once every few minutes)
i = random(200);
//Serial.println(i);
if (i == 0) {
i = random(3);
if (i == 0) {
playcomplete("rise so high.WAV");
} else if (i == 1) {
playcomplete("smoothseas.WAV");
} else if (i == 2) {
playcomplete("to climb steep hills.WAV");
} else {
playcomplete("exhalted throne.WAV");
}
}
} else if ((distsensor > 30) && (distsensor < 40)) {
if (sensorstate <= 1) { // play "smoothseas"
playcomplete("smoothseas.WAV");
} else {
i = random(60); // more often
//Serial.println(i);
if (i == 0) {
i = random(3);
if (i == 0) {
playcomplete("exhalted throne.WAV");
} else if (i == 1) {
playcomplete("to climb steep hills.WAV");
} else {
playcomplete("rise so high.WAV");
}
}
}
}
}
void ROM_playcomplete(const char *romname) {
char name[13], i;
uint8_t volume;
int v2;
for (i=0; i<13; i++) {
name[i] = pgm_read_byte(&romname[i]);
}
name[12] = 0;
Serial.println(name);
playfile(name);
while (wave.isplaying) {
volume = 0;
for (i=0; i<8; i++) {
v2 = analogRead(1) - 512;
if (v2 < 0)
v2 *= -1;
if (v2 > volume)
volume = v2;
delay(5);
}
}
//putstring("vol = "); Serial.println(volume, DEC);
}
void playfile(char *name) {
f = card.open_file(name);
if (!f) {
putstring_nl(" Couldn't open file"); return;
}
if (!wave.create(f)) {
putstring_nl(" Not a valid WAV"); return;
}
// ok time to play!
wave.play();
}
hope it's right!!
Monday, 25 May 2009
woohoo
finally uploaded sketch for wave shield onto arduino, works and everything.
hooray!
The sketch looks for the switch, when it's pressed it plays the files on the sd card. well, it should anyway. It plays a set of stupid and pointless proverbs - reflecting the aluminium slapping fortune teller sculptures' beginnings.
had to change the switch to make sure project was completed in time, instead of twitter through ethernet shield, now just going for a simpler microlever switch, with paddle adaption so that it will be triggered by people inside the room, rather than outside in internet space.
would still really like to do the twitter thing, and have the sketch in a draft state to do it, but realistically not going to get it all finished with everything else like log book and drawings and setting up exhibition space by friday afternoon. The plan is to place the twitter machine in a gallery setting sometime in the autumn, maybe in the 'da girlz' exhib?
as for project one, the repetitive sound one, in need of a power amo as the one i have is far too weedy. On testing it out in the space on sunday it sounded weak and feeble and definately not annoying. Need it louder, louder, louder and much more oomphier.
speakers will need gaffa taping as the connectors are a bit wobbly, plinths to house speakers still not here, hoping that workshop guys will have done them so I can get on an paint. Threy prob won't be, but one can hope. Have rediscovered that I am the world's most impatient person ever.
hooray!
The sketch looks for the switch, when it's pressed it plays the files on the sd card. well, it should anyway. It plays a set of stupid and pointless proverbs - reflecting the aluminium slapping fortune teller sculptures' beginnings.
had to change the switch to make sure project was completed in time, instead of twitter through ethernet shield, now just going for a simpler microlever switch, with paddle adaption so that it will be triggered by people inside the room, rather than outside in internet space.
would still really like to do the twitter thing, and have the sketch in a draft state to do it, but realistically not going to get it all finished with everything else like log book and drawings and setting up exhibition space by friday afternoon. The plan is to place the twitter machine in a gallery setting sometime in the autumn, maybe in the 'da girlz' exhib?
as for project one, the repetitive sound one, in need of a power amo as the one i have is far too weedy. On testing it out in the space on sunday it sounded weak and feeble and definately not annoying. Need it louder, louder, louder and much more oomphier.
speakers will need gaffa taping as the connectors are a bit wobbly, plinths to house speakers still not here, hoping that workshop guys will have done them so I can get on an paint. Threy prob won't be, but one can hope. Have rediscovered that I am the world's most impatient person ever.
Sunday, 24 May 2009
Saturn film
This is incredible, it's a film of saturn's rotation filmed from Hubble. It looks like a cartoon, almost not quite sure if it's real.
Tuesday, 19 May 2009
Friday, 8 May 2009
Chasing Children with Hoovers
from Graham Lineham's Twitter - i think it's impossible not to smile at this
Makezine does good again with their twitter library
Makezine does good again with their twitter library
Sunday, 3 May 2009
Arduino alert!
Really interesting Interactive Vending Machine by Ellie Harrison.
Everytime the recession is mentioned on the BBC the vending machine in the Viewpoint Gallery gives out free food.
I am thinking that this is being done in a very similar way to the twitter bubblino machine, with a microcontroller constantly checking and relaying info from a website, in this case the BBC RSS feed. RSS feeds are constantly being updated, esp on such a busy site as the BBC. Perfik.
Annoying machine update - shields ordered and shipped. circuitry confusion at a controllable level. for now.
Everytime the recession is mentioned on the BBC the vending machine in the Viewpoint Gallery gives out free food.
I am thinking that this is being done in a very similar way to the twitter bubblino machine, with a microcontroller constantly checking and relaying info from a website, in this case the BBC RSS feed. RSS feeds are constantly being updated, esp on such a busy site as the BBC. Perfik.
Annoying machine update - shields ordered and shipped. circuitry confusion at a controllable level. for now.
Subscribe to:
Posts (Atom)