Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 23
61  Using Arduino / Project Guidance / Re: Mini Piano V1.0 on: August 30, 2013, 10:53:55 am
From: http://arduino.cc/en/Reference/Board
Quote
On boards with an ATmega8, PWM output is available only on pins 9, 10, and 11

You will have to move a couple of pins around because pin 13 can't do PWM on the ATMega 8.

Pete

Ohhh, does that mean pin 13 can do PWM on atmega 328 ? I dont think so. Hahaha. I dont use any PWM on this piano smiley The arduino is generating square waveform to generate tone I think smiley-mad
62  Using Arduino / Project Guidance / Re: Mini Piano V1.0 on: August 30, 2013, 10:47:06 am
P.S. When you post code, read this: How to post code properly

You can edit your post with the code in it, click on Modify (just above and to the right of your message), find the [ quote] and [ /quote] tags around your code and change them to [ code] and [ /code] (without the space).

Pete


Thank you for this ! smiley

Appreciate ^^
63  Using Arduino / Project Guidance / Re: Mini Piano V1.0 on: August 30, 2013, 10:29:05 am
Code:
int led = A0;
int speaker = 13;
int button_1 = 0;
int button_2 = 1;
int button_3=2;
int button_4 = 3;
int button_5 = 4;
int button_6=5;
int button_7=6;
int button_8=7;
int button_9=8;
int button_10=9;
int button_11=10;
int button_12=11;
int button_13=12;

// the setup routine runs once when you press reset:
void setup() {               
  // initialize the digital pin as an output.
 
  pinMode(speaker,OUTPUT);
pinMode(0,INPUT);
pinMode(1,INPUT);
pinMode(2,INPUT);
pinMode(3,INPUT);
pinMode(4,INPUT);
pinMode(5,INPUT);
pinMode(6,INPUT);
pinMode(7,INPUT);
pinMode(8,INPUT);
pinMode(9,INPUT);
pinMode(10,INPUT);
pinMode(11,INPUT);
pinMode(12,INPUT);
pinMode(A0,OUTPUT);
digitalWrite(0,HIGH);
digitalWrite(1,HIGH);
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
digitalWrite(10,HIGH);
digitalWrite(11,HIGH);
digitalWrite(12,HIGH);
noTone(13);
}

// the loop routine runs over and over again forever:
void loop() {
  if(digitalRead(0) == LOW)
  {
     digitalWrite(led, HIGH);
    tone(13,262);
     }
    else  if(digitalRead(1) == LOW)
     {digitalWrite(led, HIGH);
       tone(13,294);
     }
      else  if(digitalRead(2) == LOW)
     {
       digitalWrite(led, HIGH);
       tone(13,330);
     }
      else  if(digitalRead(3) == LOW)
     {
       digitalWrite(led, HIGH);
       tone(13,349);
     }
      else  if(digitalRead(4) == LOW)
     {
       digitalWrite(led, HIGH);
       tone(13,392);
     }
     else  if(digitalRead(5) == LOW)
     {
       digitalWrite(led, HIGH);
       tone(13,440);
     }
     else  if(digitalRead(6) == LOW)
     {
       digitalWrite(led, HIGH);
       tone(13,494);
     }
      else  if(digitalRead(7) == LOW)
     {
       digitalWrite(led, HIGH);
       tone(13,523);
     }
     else  if(digitalRead(8) == LOW)
     {
       digitalWrite(led, HIGH);
       tone(13,277);
     }
      else  if(digitalRead(9) == LOW)
     {
       digitalWrite(led, HIGH);
       tone(13,311);
     }
     else  if(digitalRead(10) == LOW)
     {
       digitalWrite(led, HIGH);
       tone(13,370);
     }
      else  if(digitalRead(11) == LOW)
     {
       digitalWrite(led, HIGH);
       tone(13,415);
     }
      else  if(digitalRead(12) == LOW)
     {
       digitalWrite(led, HIGH);
       tone(13,466);
     }
     else
     {
       digitalWrite(led, LOW);
       noTone(13);
     }
 
     
}

This is my code.

Thank you
64  Using Arduino / Project Guidance / Re: Mini Piano V1.0 on: August 30, 2013, 09:58:31 am
The binary sketch size for that code is just 3196 bytes smiley
65  Using Arduino / Project Guidance / Re: Mini Piano V1.0 on: August 30, 2013, 09:35:11 am
Do not play the tone. All they key are same tone. Same frequency instead
66  Using Arduino / Project Guidance / Mini Piano V1.0 on: August 30, 2013, 09:23:05 am
https://gist.github.com/vick5821/6390286
I made the mini piano using this coding. When I use atmegha 328 it works perfectly. However, when I upload the code through USB or USBasp to the atmega 8, it does not work as expected.

What is the problem actually ? Suppose any kind of cheap should work ?

Thanks !
67  Using Arduino / Programming Questions / Re: Car chasis with HC-SR04 sensor on: August 05, 2013, 01:33:40 pm
Ok, thanks for pointing out my mistakes.

Will do better smiley
68  Using Arduino / Project Guidance / Re: Documentation Coding on: August 05, 2013, 01:38:44 am
Thank you so much !

Appreciate your kind help smiley
69  Using Arduino / Project Guidance / Re: Documentation Coding on: August 05, 2013, 01:28:24 am
Do you have the list of colours ? That would be perfect.

Thanks and appreciate smiley
70  Using Arduino / Project Guidance / Re: Documentation Coding on: August 05, 2013, 01:24:12 am
Yes, I am changing. Will update soon !

Thanks alot !
71  Using Arduino / Project Guidance / Re: Documentation Coding on: August 05, 2013, 01:20:13 am
But I think can change the colour scheme right ? Just I am not sure what is the colour scheme for instructions and so....

Thank you
72  Using Arduino / Project Guidance / Re: Documentation Coding on: August 05, 2013, 01:10:22 am
Okay, the steps work well !

This is what I get as attached. But somehow a little bit different colour and format when like open up in arduino IDE

Any ideas ?

Thank you

73  Using Arduino / Project Guidance / Re: Documentation Coding on: August 05, 2013, 12:58:50 am
Do I need to do the steps everytime when I wanted to copy a new code to MS Word ?

Thank you
74  Using Arduino / Project Guidance / Documentation Coding on: August 04, 2013, 10:32:31 pm
Dear all, what software can I use to get my code neatly display in my documentation for arduino code in mirosoft word ?

See the attachment for more details.

Thank you.
75  Using Arduino / Programming Questions / Re: Car chasis with HC-SR04 sensor on: August 04, 2013, 10:59:09 am
I actually just copy the code from arduino IDE and I select copy to forum then I paste everything here. Did I do mistakes ?

Thanks for pointing out to me if any smiley
Pages: 1 ... 3 4 [5] 6 7 ... 23