I am currently on project 6 of the arduino starter kit (light theremin),
and although I read the descriptions thouroghly, I fail to understand:
what is the difference between PWM and the tone() function?
why couldn't we just use the PWM to control the Piezo?
when would you use PWM normally, and when tone()?
other shorter and more general issues I wondered about:
1. is there a "correct" way to disconnect the arduino after running a script?
or should I just unplug it?
2. Should I reset or something after every use? or is it ok if the script stays on it till the next upload?
(I worry that running an old script with a different wiring might screw something up)
3. is it normal that some components are quite tricky to fit into the breadboard?
(specifically: photorsesistors, potentiometers, capacitors)
lots of questions but would appretiate any help!
Using the built in arduino PWM (analogWrite), the frequency is unchanging. It is always something around 490Hz, but the duty-cycle (on-off ratio) is changeable.
1) Pretty much just unplug it. The only problem I can think of off hand would be if you are writing to the EEPROM just as the power is pulled.
2) Leaving a script in flash between uses of the board will have no effect.
3) Different breadboards are like this. Some would rather fold over a wire rather than let it plug in. Some are too loose and some are really nice. Cost has a lot to do with it.