background preloader

Programming

Facebook Twitter

Playground - MatrixMath. Avr-libc: <math.h>: Mathematics. Detailed Description This header file declares basic mathematics constants and functions.

avr-libc: <math.h>: Mathematics

Notes: In order to access the functions declared herein, it is usually also required to additionally link against the library libm.a. See also the related FAQ entry.Math functions do not raise exceptions and do not change the errno variable. Therefore the majority of them are declared with const attribute, for better optimization by GCC. Define Documentation The natural logarithm of the 10. The natural logarithm of the 2. The logarithm of the e to base 10. The logarithm of the e to base 2. Function Documentation The acos() function computes the principal value of the arc cosine of __x. The asin() function computes the principal value of the arc sine of __x.

The atan() function computes the principal value of the arc tangent of __x. The atan2() function computes the principal value of the arc tangent of __y / __x, using the signs of both arguments to determine the quadrant of the return value. Note: Returns: ShiftOut. Learning Examples | Foundations | Hacking | Links Started by Carlyn Maw and Tom Igoe Nov, 06 Shifting Out & the 595 chip At sometime or another you may run out of pins on your Arduino board and need to extend it with shift registers.

ShiftOut

This example is based on the 74HC595. The datasheet refers to the 74HC595 as an "8-bit serial-in, serial or parallel-out shift register with output latches; 3-state. " How this all works is through something called "synchronous serial communication," i.e. you can pulse one pin up and down thereby communicating a data byte to the register bit by bit. The "serial output" part of this component comes from its extra pin which can pass the serial information received from the microcontroller out again unchanged.

"3 states" refers to the fact that you can set the output pins as either high, low or "high impedance. " Here is a table explaining the pin-outs adapted from the Phillip's datasheet. Example 1: One Shift Register. Arduino Interrupts. Often when working on microcontroller projects you need a background function to run at regular intervals.

Arduino Interrupts

This is often done by setting up a hardware timer to generate an interrupt. The interrupt triggers an Interrupt Service Routine (ISR) to handle the periodic interrupt. In this article I describe setting up the 8-Bit Timer2 to generate interrupts on an Arduino ATMega168. I walk through steps required for setup and inside the ISR function. If you are following the Arduino sound articles this one will be important to read as well. The Arduino default processor is an ATMega168 (datasheet link). Interrupts? Interrupts Links When a new character arrives the UART system generates an interrupt. If you have lots of interrupts firing or fast timer interrupts your main code will execute slower because the microcontroller is spreading it’s processing time between your main code and all the ISR functions.

With an interrupt you don’t have to keep checking to see if a character has arrived. Modkit.