4 ms·
So You Got an Arduino
- sketerpot 17y agoWhen I was first learning microcontroller programming, nobody told you this stuff. The great thing about the Arduino community is that it makes casual hacking so much easier to get into. Another great resource for hardware hacking is the SparkFun tutorials: http://www.sparkfun.com/commerce/tutorials.php http://www.sparkfun.com/commerce/tutorials.php
- paulgb 17y agoThere are builtin “software” pull-up resistors Cool, didn't know that. I've seen it used in code once, but I couldn't understand why someone would write to an input pin.
- sketerpot 17y agoThey're not really software resistors; they're hardware that's controllable from software. </pedantry> And this is very useful; this will definitely save some resistor wiring. Now if only there was some easy way to debounce a switch in software....
- kd5bjo 17y agoIt's not too bad: keep an exponentially decaying average of the pin state, and use some hysteresis (different levels for on/off) on that value. You should be most of the way there. It'll take (worst case) 8 bits for the average and 1 for the current state. You could probably still get reasonable results with a 7-bit average so that the whole thing still fits in a byte of RAM.
- carterschonwald 17y agoIs it just me, or does this idiom sound very similar to one of the critiqued "incorrect" programming idioms in the recently analyzed breathalyzer code?
- kd5bjo 17y agoYes; it's almost identical. It's one of the simplest digital low-pass filters you can write. Basically, it does the same thing that an analog R/C filter would do (given sufficient precision and sampling rates). The issue with the breathalyzer code wasn't that the algorithm was incorrect, but that the programmer used the wrong algorithm.
- mindslight 17y agoAfter reading a button press, wait a while for the level to settle (say 50ms or so). This kind of thing is normally done from a timer interrupt that polls all buttons and saves their state for the foreground thread (I'd think this would be in the Arduino library somewhere).
- adbachman 17y agoIt (debouncing) is available as a library from the arduino site: [http://www.arduino.cc/playground/Code/Debounce](http://www.arduino.cc/playground/Code/Debounce) http://www.arduino.cc/playground/Code/Debounce](http://www.a...
- aswanson 17y agoI really wish the ATMega chip family had built in usb functionality. That would make them a good competitor to the Microchip PIC 18F family.
- paulgb 17y agoOut of curiosity, is it possible to get USB functionality out of the chip at the software level? Or is speed the issue?
- fhars 17y agoYes, you can, but obviously speed is an issue. You will never saturate an USB 2.0 link with a pure software stack on an ATMega, but reading out a few sensors or some input device that is limited by the speed of the user's fingers is possible, search for avr-hid or hidkeys (can't copy and paste URLs in Opera Mini).
- paulgb 17y agoCool, thanks.
- samlittlewood 17y agoDo these meet your requirements? ATmega16U4 http://atmel.com/dyn/products/product_card.asp?part_id=4380 http://atmel.com/dyn/products/product_card.asp?part_id=4380 ATmega32U4 http://atmel.com/dyn/products/product_card.asp?part_id=4317 http://atmel.com/dyn/products/product_card.asp?part_id=4317 Or use an AT90USBxxx part like on: http://www.pjrc.com/teensy/index.html http://www.pjrc.com/teensy/index.html
- aswanson 17y agoYes, thank you very much.
- Raphael 17y agoUSB is serial.
- cake 17y agoI was hoping to have some examples of projects. I'm interested in Arduino but have yet to find a good project to begin with.
- torpor 17y agoThe critter-guitari Pocket Piano is a great shield for Arduino, and it has the advantage that it gives you a lot of hardware to play with as well .. http://www.critterandguitari.com/home/store/arduino-piano.php http://www.critterandguitari.com/home/store/arduino-piano.ph... I built one for fun, and ended up using it in jam sessions as a serious synth. Great!