SparkFun will be closed Nov 26th and 27th for the Thanksgiving holiday. Orders placed after 2:00pm MT on the 25th will ship out Monday the 30th.
Track My Order
Frequently Asked Questions
International Shipping Info
Mon-Fri, 9am to 12pm and
1pm to 5pm U.S. Mountain Time:
Chat With Us
October 4, 2006
Tutorial - Processor Interrupts with Arduino
about 4 years ago
The “standard” way of handling this is to make the counter variables unsigned, but make the comparison signed using the same size variable. If the counters wrap 0xffffffff to 0x00000000 then all is OK.
The code as written works correctly on gcc 4.2.1 (i686-apple-darwin10; haven’t checked arduino) because the subtraction in the if statement is being done into long. One could be more explicit about it by casting the subtraction as a long before making the comparison:
if ((long)(button_time - last_button_time) > 250)
If the subtraction gets up-cast into a bigger variable, then there will be a wrap problem. For example if the counters were unsigned char, and the subtraction was not cast as char, then there will be a wrapping problem:
unsigned char t1=0xff;
unsigned char t2=0x01;
if (t2 - t1 > 0) printf (“greater”); // Does not work!
if ((char)(t2 - t1) > 0) printf (“greater”); // Works!
News - Little Box Stores
about 4 years ago
Another vote for Baynesville. Also the Maryland Science Center http://www.mdsci.org/ has an extensive gift shop. Science center/museum gift shops in general should carry your retail kits.
News - Open Source Hardware
about 5 years ago
“You guys take my hard work and make an improvement"
My question is whether there is a requirement to then leave this improvement as open and under the same license (in the GPL style), or if this improvement can now fall under a different license by the improver (in the BSD style)?
As a developer of free software (and more recently hardware), my personal preference is for licenses that ensure that derivative works remain free, but I also contribute to (and derive benefit from) works under more permissive licenses. Where does OSHW stand on this? Instead of reviving a 20 year old flame-war, I think there should be two types of licenses differing in this important aspect.
No public wish lists :(
Forgot your password?
No account? Register one!