the analog outputs on the arduino allows the voltage to vary between and 5, but it stays constant during each void() loop iteration. how do i get an actual analog output from my arudino? I'm trying to put a music input through two pins (sig + gnd) and output it through another analog pin.
You get PWM out not a analog voltage.
analogWrite is a crap name for the function- I reckon it should be (should have been) called PWMWrite and put an end to the confusion. It's not unreasonable to expect an analogWrite to be, well, analog.....
I reckon it should be (should have been) called PWMWrite
Or maybe linearOut() ![]()
#define linearOut analogWrite
JimboZA:
analogWrite is a crap name for the function- I reckon it should be (should have been) called PWMWrite and put an end to the confusion. It's not unreasonable to expect an analogWrite to be, well, analog.....
PWMwrite gets my vote.
bmarconi:
it stays constant during each void() loop iteration.
What do you mean? It will change each time your sketch does an analogWrite()...
bmarconi:
I'm trying to put a music input through two pins (sig + gnd) and output it through another analog pin.
This is beyond the capabilities of most Arduino, in the way you are thinking. Maybe a Due or Teensy 3.1. But not Uno, its processing speed and analog/digital/analog converters are just not fast enough. But why are you trying to do this? What is the application? There may be another way.
I'm trying to put a music input through two pins (sig + gnd) and output it through another analog pin.
Well you can do this but the results will be poor and you will need a low pass filter on the PWM output pin. You will also need to up the frequency of the PWM signal first. It might also help to speed up the analogRead function first, as the output is only going to be 8 bits then you can up the A/D clock up to 1MHz to get the sample rate faster.
However if you are just going to output the signal you input why bother with an arduino at all. A piece of wire is mush cheaper and has a great sample rate.
Unless of course you are holding out on us and not saying what you actually want to do, but you would not be a crass as that would you?
apparently my reply got posted as a separate thread.
2 questions:
1.) how do i send things over a LAN to my ethernet shield?
2.) if i can send music files over to my ethernet shield, what would my arduino do with that input? does it just convert everything to digital?
- look at the examples in the Ethernet libary for how to transfer things.
- music files, in fact any file is digital so there is no need to convert it to digital. However an arduino has not got enough memory to store much of a file so you have to put It into an SD card. There is nothing you can do about playing an MP3 file in an arduino but you can play wav files.