Pages: [1]   Go Down
Author Topic: need urgent help in programming arduino to drive Chladni Plate (deadline 22th 03  (Read 3851 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry for disturbing! But I need help!
I made a project for my design studies. It is a kind of a electric Chlandi Plate which must work as a time indicator (another words - a clock)


picture from Instructables

I made my generator, but stuck on programming an Arduino.  Please, help my to made a program!
My design idea is to change the patterns on a plate in two ways:
1)automatically after a certain period of time
2) manually - when press the button
at the same time the LEDs, which lighten the plate must change their colours.

Plus, to choose the correct frequencies of generator i need a Serial Console.

My problem is - that I have bought the Arduino 2 weeks ago and still learn how to program it.

And I need to finish this object to 22th of March - in two days!

Thank You for Your attention!
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 168
Posts: 12430
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't understand what you try to achieve (except it is some sort of clock)

Can you explain more and share the code you have allready?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I need a device to command a mechanical plate driver.
so, it must produce 12 different sound frequencies. Every frequency must change in some minutes, AND has an option to change "manually", by pressing a key. Every frequency must have a "unique" colour-combination of the LEDs (this LEDs are lighten the plate).

Code... I tried a code from the arduino tutorials: mood lamp (works fine), serial controlled buzzer (don't want to work), buzzer (works fine).

My problem that when I combine the code from different programs, set the names of the variables - the code doesn't want to work

I will show my program in Monday, when I get to my working computer - the code is there

Now the Arduino only buzz on 6000Hz for 10 seconds, wait for a 30 seconds and buzz again
 
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24322
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
the code doesn't want to work

Maybe if you pointed out to it what will happen to it if it doesn't?

Have you thought about using the tone library?

(Or, show us the code)
« Last Edit: March 20, 2011, 04:39:44 pm by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 36
Posts: 5519
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This might help others to understand what (I think) is trying to be done:

http://www.physics.ucla.edu/demoweb/demomanual/acoustics/effects_of_sound/chladni_plate.html

So - if I understand the OP - s/he wants the frequency (?) to change to one of 12 different frequencies (per hour?) - so a different pattern is shown for each time interval (each hour?) - I think.

 smiley
Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

well... It was the mix of different programs. It is hard to understand smiley-kitty

So, I tried to make the new code from the scratch.

It is the early draft  smiley-confuse

Quote

char buffer[18];  //input buffer
int red, green, blue;

int RedPin = 9;   // red LED
int GreenPin = 10; //green LED
int BluePin = 11;  // Blue LED
int spkr = 13;  // speaker output
int button = 7; // button
int numChar = Serial.available();
long previousMillis = 0;   //interval
long interval = 5000;

void setup()
{
  Serial.begin(9600); //serial port
Serial.flush();  
pinMode(RedPin, OUTPUT);
pinMode(GreenPin, OUTPUT);
pinMode(BluePin, OUTPUT);
pinMode(spkr, OUTPUT);
pinMode(button, INPUT);

/*I can't manage with serial control of the tones.
And has a difficulties with logical operations to control a button
(I mean - if you press the button the frequency changes. If not -
"the interval" change the frequency)
The code to change the power of LEDs - not the problem.
I will add it later
*/

}
void loop()
{
  tone (spkr, 1000, 2000);                 // tone 1
                                            //here must be the code to change the colour of LEDs
  if (millis() - previousMillis > interval);
  
  tone (spkr, 2000, 2000);                 // tone 2
  if (millis() - previousMillis > interval);
  
  tone (spkr, 3000, 2000);                 // tone 3
  if (millis() - previousMillis > interval);

tone (spkr, 4000, 2000);                 // tone 4
  if (millis() - previousMillis > interval);
  
  tone (spkr, 5000, 2000);                 // tone 5
  if (millis() - previousMillis > interval);
  
  tone (spkr, 6000, 2000);                 // tone 6
  if (millis() - previousMillis > interval);
  
  tone (spkr, 7000, 2000);                 // tone 7
  if (millis() - previousMillis > interval);
  
  tone (spkr, 8000, 2000);                 // tone 8
  if (millis() - previousMillis > interval);
  
  tone (spkr, 9000, 2000);                 // tone 9
  if (millis() - previousMillis > interval);
  
  tone (spkr, 10000, 2000);                 // tone 10
   if (millis() - previousMillis > interval);
  
   tone (spkr, 11000, 2000);                 // tone 11
  if (millis() - previousMillis > interval);

tone (spkr, 12000, 2000);                 // tone 12
  if (millis() - previousMillis > interval);
}

« Last Edit: March 21, 2011, 01:39:19 am by antsnark » Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24322
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
  if (millis() - previousMillis > interval);

That statement does nothing if it is true...and nothing if it is false.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

AWOL

this is from the example Blink Without Delay

How to do the change the frequency and LEDs colour without use of delay function?

And how to do the use of a button?

I'm stuck  smiley-sad

Now I made a mechanical part of the Chladni-plate.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24322
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
this is from the example Blink Without Delay

With the semicolon?
I don't think so.
Read the example again, carefully.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

stupid me  smiley-sad
 smiley

anyway, would You be so kind, and write correct code for serial part of the program? To change the frequencies from serial console. It is too long to compile and upload new frequencies every time.

I just don't understand how it works.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 smiley-twist smiley-evil smiley-evil smiley-evil smiley-evil smiley-evil

just break my new arduino uno!!!   smiley-cry smiley-cry smiley-cry smiley-cry smiley-cry smiley-cry smiley-cry smiley-cry smiley-cry smiley-cry

now try to reanimate it (stupid serial port bug.........)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset



found on a russian site

Code:
#define R3_PIN       A0
#define SPEAKER_PIN  11

#define T2_WGM   0b010
#define T2_COMA  0b01
#define T2_CS    0b111

void setup() {
  TCCR2A = (T2_COMA << 6) | (T2_WGM & 0b011);
  TCCR2B = ((T2_WGM & 0b100) << 1) | T2_CS;
  OCR2A = 255;
   pinMode(R3_PIN, INPUT);
  pinMode(SPEAKER_PIN, OUTPUT);
}
void loop() {
  OCR2A = map(analogRead(R3_PIN), 0, 1023, 0, 255);
}

sounds good and loud. But without change frequency after interval. It is analogue.

PS  still can't launch IDE on my fedora netbook  smiley-evil
« Last Edit: March 23, 2011, 11:58:35 am by antsnark » Logged

Pages: [1]   Go Up
Jump to: