Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 11
61  Forum 2005-2010 (read only) / Syntax & Programs / arduino BT and serial commands on: March 11, 2010, 01:24:57 pm
Hi

I am getting weird results with this code. If I send an "a" I get a response, but only once. Sending a "d" freezes the serial monitor. If hit "b" after "a" nothing happens, but no character works after that.

thanks for help

Code:

int ledPin =13;

int SOLENOID1 = 5;
int SOLENOID2 = 7;
int SOLENOID3 = 10;
int SOLENOID4 = 12;

int solenoids[] = {SOLENOID1,SOLENOID2,SOLENOID3,SOLENOID4};
int cnt = 0;

void setup()
{
  Serial.begin(115200); //init of the serial com
  pinMode(ledPin, OUTPUT);
  for(int i=0;i<4;i++){
    pinMode(solenoids[i], OUTPUT);
  }
}

void loop()
{
  
  cnt++;
  cnt %= 20;
  if(cnt < 10) digitalWrite(ledPin, LOW);
  else digitalWrite(ledPin, HIGH);
  
  
  for(int i=0;i<4;i++){
    digitalWrite(solenoids[i], LOW);
  }
  delay(50);
  checkInput();
  delay(50);
  //Serial.println("loop");
}

void checkInput(){
//  boolean hadInput = false;
  if ( Serial.available()) { // serial reception
    char ch = Serial.read();
    int solenoidID = -1;
    switch(ch) {
    case 'a': // numeric value
      solenoidID = 0;
      break;
    case 'b': // reading of the letter
      solenoidID = 1;
      break;
    case 'c':
      solenoidID = 2;
      break;
    case 'd':
      solenoidID = 3;
      break;
    }
    
    if(solenoidID > -1){
      Serial.print("SOLENOID : ");
      Serial.println(solenoidID);
      digitalWrite(solenoids[solenoidID], HIGH);
    }    
    
  }
}
62  Forum 2005-2010 (read only) / Syntax & Programs / Re: designing PWM sounds on: January 07, 2010, 02:41:09 am
Hey

I am specifically looking for the "unrealistic chiptune-sounding explosion"!

How do I go from sound to code though? or is maybe there a chip I should work with here?


Thanks

fub
63  Forum 2005-2010 (read only) / Syntax & Programs / designing PWM sounds on: January 06, 2010, 06:29:39 am

How would one go about creating a specific sound effect for crude piezo PWM playback. I am specifically trying to make the sound of an explosion.

how did they do it back in the day on the game & watch for example.

I really want the piezo, not a wave shield.

fubbi
64  Forum 2005-2010 (read only) / Syntax & Programs / Re: Simple button switcher with LED indication on: April 23, 2009, 12:55:40 pm
Hi

it's an old east german thing that doesn't look like it wants to be opened

outside of that, it's still hanging on the breadboard just lighting up an LED for now

fubbi
65  Forum 2005-2010 (read only) / Syntax & Programs / Re: Simple button switcher with LED indication on: April 23, 2009, 11:40:05 am
Hi

I am using an old footswitch to switch a laser on and off and mikalhart's solution is very nice.

The scripts main part sends midi controller values and I dont want that to stutter by
adding delay but the footswitch "spills" a lot. So I need the switch state to be less sensitive,
maybe using millis?

Thankful for advice

fubbi
66  Forum 2005-2010 (read only) / Interfacing / Re: Piezo and drumkit on: August 13, 2008, 02:57:29 pm
sooo, i got it working based on the diagram in the tutorial:

http://todbot.com/blog/2006/10/29/spooky-arduino-projects-4-and-musical-arduino/

and i got the serial going with isadora.

I am getting bursts of serial data which I would like to smooth and fade out. basically I need every stroke on the drum to send a value and then "ring out"

this arduino script (copy-paste compilation of various scripts):
Code:
int value; // reading of input
int value_a = 0; //memory of value
int ledPin = 13;  // flashes on contact
int piezoPin = 0; // reads the piezo

int THRESHOLD = 100;  // set minimum value that indicates a knock

int PieVal = 0;       // variable to store the value coming from the sensor

// end piezo business

void setup()
{
  pinMode(ledPin, OUTPUT);
  Serial.begin(19200); //init of the serial com
}

void loop() {
  digitalWrite(ledPin,LOW);     // indicate we're waiting
  PieVal = analogRead(piezoPin);   // read piezo
  if( PieVal >= THRESHOLD ) {      // is it bigger than our minimum?
    digitalWrite(ledPin, HIGH); // tell the world
    value = PieVal; // analog input 0 to value a in Isadora
    Serial.print("a"); // tag for each value
    Serial.println(value); // this sends Isadora a value like "a356"
  }

}

gets me a burst of data like this (on a single stroke)

Code:
a148
a136
a875
a495
a464
a148
a100
a398
a501
a423
a458
a514
a591
a590
a564
a492
a427
a366
a329
a290
a269
a238
a224
a208
a190
a176
a165
a155
a145
a137
a131
a123
a116
a108
a101

if anyone who actually knows how to write scripts could point me in the direction of how to grab the highest value and then let it fade back to zero, it would be a very big help.

I have to get this going pretty fast and I am stuck in my limited programming capabilities

thanks

fubbi

67  Forum 2005-2010 (read only) / Interfacing / Re: Piezo and drumkit on: August 12, 2008, 10:05:47 am
Hi, thanks for all the info's

I will use Isadora to trigger video samples directly over serial so no need for midi.

I have the basics down for serial comm. between arduino and isadora, but I hope I will be able to calibrate and smooth the values enough.

That tutorial should still be the right diagram for me though right?
Except the output wich would be USB serial and not midi in my case.

Will post here as soon as I have it together

fubbi
68  Forum 2005-2010 (read only) / Interfacing / Piezo and drumkit on: August 12, 2008, 05:06:12 am


Hello


I want to mike up a regular drumkit. Is it a good idea to use piezos and arduino?

I would want to make "soft triggers" to register the strength and decay of the beats.

Thanks for any advice

fubbi
69  Forum 2005-2010 (read only) / Development / Re: timer function or library... on: February 28, 2010, 12:11:56 pm
Can somebody please explain how I do this. I know I have to do it with millis but I just can't make it work.

I need to tell the functions how long they should run for.

Thank you for any help on this

fub

void loop()                    
{
  
blueFade(); // FOR 5-15 MINUTES

int chance = random(10);
if (chance <= 7){
  kase = 1;
} else {
  kase = 2;
}
  switch (kase) {
    case 1:
greenFlash(); // FOR 10-30 SEC
      break;
    case 2:
  redFlash(); // FOR 10-30 SEC
      break;
  }
  
}

EDIT:


I got it going:

unsigned long timerOffset;

void setup()                    
{
  pinMode(blue, OUTPUT);  
  pinMode(red, OUTPUT);    
  pinMode(green, OUTPUT);      
}

void startTimer(){
    timerOffset = millis();
}

boolean checkTimer(int duration)
  {
    if((millis()-timerOffset)/1000 > duration) return true;
    return false;
  }


void blueFade(int duration){
  startTimer();
  while(!checkTimer(duration)){
doBlue();
    delay(100);
  }  
}
void greenOn(int duration){
  startTimer();
  while(!checkTimer(duration)){
greenFlash();
    delay(100);
  }  
}
void redOn(int duration){
  startTimer();
  while(!checkTimer(duration)){
redFlash();
    delay(100);
  }  
}

void loop(){
  
  greenOn(10);
  redOn(10);
  blueFade(10);

}
70  Forum 2005-2010 (read only) / Troubleshooting / Arduino BT no longer communicating - emergency... on: November 27, 2009, 04:53:01 pm


Hi

I have an artpiece I just installed in Reykjavik. I just built a replica for the Art basel Miami which opens on tuesday.

But the BT has just given up. It's a total mystery. I have one brand new BT, and one old and that always worked. I tried four different macs, in two different rooms. I tried firmata. I tried everything.

The script works fine with a duemilanove. The hardware works fine with a duemilanove.
The whole thing works fine with the BT in reykjavik where it runs everyday.

The script recieves a, b, c, d over serial and triggers a solenoid per letter. Very simple.

I can still upload to to the BT. And if I upload a script that just triggers the solenoids in sequence over and over, it does it without complaining. But as soon as I start sending serial - no banana. I also get a lot of stalling in all programs I use to try to send the serial data (Isadora, arduino serial monitor, goSerial etc).

Basically freaking out trying to solve this. Flying to miami in 24h. Desperate.

Thanks for any input

the hardware is basically this x 4
http://www.arduino.cc/playground/uploads/Learning/solenoid_driver.pdf

And this is the one script I would like to use:

Code:
int ledPin =13;

int SOLENOID1 = 4;
int SOLENOID2 = 5;
int SOLENOID3 = 10;
int SOLENOID4 = 7;

int solenoids[] = {SOLENOID1,SOLENOID2,SOLENOID3,SOLENOID4};
int cnt = 0;

void setup()
{
  Serial.begin(115200); //init of the serial com
  pinMode(ledPin, OUTPUT);
  for(int i=0;i<4;i++){
    pinMode(solenoids[i], OUTPUT);
  }
}

void loop()
{
  
  cnt++;
  cnt %= 40;
  if(cnt < 5) digitalWrite(ledPin, LOW);
  else digitalWrite(ledPin, HIGH);
  
  for(int i=0;i<4;i++){
    digitalWrite(solenoids[i], LOW);
  }
  delay(50);
  checkInput();
  delay(50);
  Serial.println("loop");
}

void checkInput(){
  boolean hadInput = false;
  if ( Serial.available()) { // serial reception
    char ch = Serial.read();
    int solenoidID = -1;
    switch(ch) {
    case 'a': // numeric value
      solenoidID = 0;
      break;
    case 'b': // reading of the letter
      solenoidID = 1;
      break;
    case 'c':
      solenoidID = 2;
      break;
    case 'd':
      solenoidID = 3;
      break;
    }
    
    if(solenoidID > -1){
      Serial.print("SOLENOID : ");
      Serial.println(solenoidID);
      digitalWrite(solenoids[solenoidID], HIGH);
    }    
    hadInput = true;
  }
  if(hadInput) Serial.flush();
}
71  Forum 2005-2010 (read only) / Troubleshooting / Re: urgent, trying to neutralise flourescent tube prob on: October 08, 2009, 07:09:46 am
thanks a lot mike!

I am going to try a few things out

fub
72  Forum 2005-2010 (read only) / Troubleshooting / Re: urgent, trying to neutralise flourescent tube prob on: October 08, 2009, 04:51:14 am
Learning (the hard way) by doing! I learned a lot doing that PCB for sure. I welcome any critique.

A 100[ch937] R (2W) burned straight away. I have some cement 5W resistors, could it be that simple? Will a 10[ch937] resistor not burn?

Will this little resistor really save me?

thanks

fubbi

73  Forum 2005-2010 (read only) / Troubleshooting / Re: urgent, trying to neutralise flourescent tube prob on: October 07, 2009, 05:56:01 pm
Hi

Excuse me, I didn't explain that I actually create the spark by touching the cables together and pulling them apart. I do this to test the size of the on-rush spark and the off-rush spark. Its very revealing.

The 4.7µF cap generates a massive on-spike and without it there is a large off-spike. The cap setup will cramp the relays up in open mode for sure. Setup works best with just the RC's described in my earlier post.

The smaller spark/spike with just the RC's will confuse the board and cause irregular switching. Not crazy bad, but it indicates wear and tare which might get worse and ruin stuff along the line. Also a programmer is writing a nice animation software for it and shouldn't be fragile. It must be able to rock.

Everything is x64 the trouble. Taking the caps back out took many many hours. Otherwise it is a pretty cool piece

fubbi

some images, actually hangs free by now:
http://fubbi.com/09/index.php?id=dirkbell
74  Forum 2005-2010 (read only) / Troubleshooting / Re: urgent, trying to neutralise flourescent tube prob on: October 07, 2009, 12:37:58 pm


It's not working

I am really running out of ideas here. These crappy tubes create a huge spark when turned off. I added a 7µF CAP which eliminated that spark, but now the tubes create a enormous surge when turned on (as the cap charges itself I suppose). This completely freezes up the relays.

The tubes have no protection being the cheapest kind, but I have no way of replacing them now. I gotta combat the spark.

Today I tried this little buddy: http://www.farnell.com/datasheets/338755.pdf
But it is far to slow to even react to my monster spark...

I have had a electrician look at it but he is dumbfounded. All he could tell me was that the spark is powerful enough for welding  smiley

Any ideas?

Thank you

fubbi
75  Forum 2005-2010 (read only) / Troubleshooting / Re: urgent, trying to neutralise flourescent tube prob on: September 26, 2009, 03:28:13 pm
thanks!

got 64 tubes hanging off 3x19 amps.

the tubes can potentially kick back up to 180 w

these rc modules are what i use for decoupling (from the other thread where you so kindly helped me).

i pray it holds...
Pages: 1 ... 3 4 [5] 6 7 ... 11