Go Down

### Topic: Tone() (Read 4073 times)previous topic - next topic

#### Noam

##### Jun 07, 2010, 03:01 pm
Hi.

Simple Q

What is the highest Hz the Arduino can give with the tone() function?

Thanks.

#1
No buddy knows?

#### besteast

#2
##### Jun 08, 2010, 03:23 am
why not google it ?

#### bhagman

#3
##### Jun 08, 2010, 08:00 am
Since tone() only accepts a frequency value as an unsigned int, the maximum frequency you can ask for is 65535 Hz (technically, you'll get 65573.77 Hz) - well beyond what the human ear can perceive.

b
http://wiring.org.co/ - Wiring - Where Arduino came from. (Wiring begat Arduino)

http://loftypremises.com/ - Everything you wanted to know about me.... and less

http://roguerobotics.com/ - #1 Canadian Arduino distributor

#### Noam

#4
##### Jun 08, 2010, 09:03 am
Are you sure about it?

the Arduino clock is much faster and it you can get higher frequency only buy writing HIGH, delaymicro, LOW, delay...

I tried it yesterday with X as frequency and a analogRead to control the X.

I gut up to over 100000Hz.

Then I tried 20Mhz, I wrote 20000000, witch is the Arduin Duemilanove clock.

It worked, but I am not sure at witch frequency...

The way I chekt it was plugging the output to antenna and trying to read volt that is crated on a diode witch is grounded from one side and connected to other antenna on the other side

Are you sure in what you are saying? , Or did I do some thing wrong?

#### Grumpy_Mike

#5
##### Jun 08, 2010, 10:11 am
Quote
The way I chekt it was plugging the output to antenna and trying to read volt that is crated on a diode witch is grounded from one side and connected to other antenna on the other side

That doesn't measure the output frequency only that something is being produced. With a 16MHz clock I would be surprised if you could get any signal greater than 1MHz out of it. However, tone is written for audio outputs so there is little point pushing it over the audio range.

#### Groove

#6
##### Jun 08, 2010, 10:33 am
Quote
Are you sure about it?

How much more sure than:
Code: [Select]
`void tone(uint8_t _pin, unsigned int frequency, unsigned long duration)`
can you be?
Per Arduino ad Astra

#### Noam

#7
##### Jun 08, 2010, 03:50 pm
Maybe we can just start a witch hunt...

So it is coz of the int the is in the tone(), witch define the Hz, that can go over 60000...

Ok thanks.

#### Grumpy_Mike

#8
##### Jun 08, 2010, 04:14 pm
Quote
witch define the Hz, that can go over 60000.

which [size=16]can't[/size] go over 60000

#### Noam

#9
##### Jun 08, 2010, 04:44 pm
Opss... that the "t" is MISSING!!!!

Sorry dude... having a bad day or some thing?

#### bhagman

#10
##### Jun 08, 2010, 10:28 pmLast Edit: Jun 08, 2010, 10:29 pm by bhagman Reason: 1
That's Grumpy Mike... By definition, he's ALWAYS having a bad day!
*SMOOCHES for Grumpy Mike*

So, yes, the limitation on the maximum frequency is because of the variable's value range.

If you modified tone() to accept frequency as unsigned long, it could produce signals as high as 8 MHz (on a 16 MHz part).

b

FYI, I'm sure, because I wrote the Tone library.
http://wiring.org.co/ - Wiring - Where Arduino came from. (Wiring begat Arduino)

http://loftypremises.com/ - Everything you wanted to know about me.... and less

http://roguerobotics.com/ - #1 Canadian Arduino distributor

#### Noam

#11
##### Jun 09, 2010, 10:26 am
Thanks, and sorry Grumpy Mike...

Can one do what you just said, modified tone()?

#### bhagman

#12
##### Jun 09, 2010, 01:29 pm
What do you need to do exactly?  There is probably a much easier solution.

b
http://wiring.org.co/ - Wiring - Where Arduino came from. (Wiring begat Arduino)

http://loftypremises.com/ - Everything you wanted to know about me.... and less

http://roguerobotics.com/ - #1 Canadian Arduino distributor

#### Noam

#13
##### Jun 09, 2010, 11:09 pm
I was thinking to use it to make some weak, easy to control, radio signal.

If I use the pin HIGH, delay, pin LOW, delay.

I get a problem, that what ever I write on the program will change the signal, that why I was thinking about using tone()

What do you think?  :-?

#### Grumpy_Mike

#14
##### Jun 10, 2010, 09:32 am
I think you better look up the law in your country about radio transmitters. I think you will find that what you want to do is illegal.

Go Up

Please enter a valid email to subscribe