background preloader

PortManipulation - Aurora

PortManipulation - Aurora
Reference Language | Libraries | Comparison | Changes Port registers allow for lower-level and faster manipulation of the i/o pins of the microcontroller on an Arduino board. The chips used on the Arduino board (the ATmega8 and ATmega168) have three ports: B (digital pin 8 to 13) C (analog input pins) D (digital pins 0 to 7) Each port is controlled by three registers, which are also defined variables in the arduino language. The DDR register, determines whether the pin is an INPUT or OUTPUT. DDR and PORT registers may be both written to, and read. PORTD maps to Arduino digital pins 0 to 7 DDRD - The Port D Data Direction Register - read/write PORTD - The Port D Data Register - read/write PIND - The Port D Input Pins Register - read only PORTB maps to Arduino digital pins 8 to 13 The two high bits (6 & 7) map to the crystal pins and are not usable DDRB - The Port B Data Direction Register - read/write PORTB - The Port B Data Register - read/write PINB - The Port B Input Pins Register - read only

Related:  ArduinoCoding TricksArduino

StepperBipolarCircuit - Aurora Reference Language | Libraries | Comparison | Changes Two Pins Four Pins Reference Home Maximum pin toggle speed Hmm. This was asked over on AVRFreaks, and it's FREQUENTLY a Frequently asked question about CPUs/etc, though I don't recall ever seeing it asked here. Since I actually did the experiment, I'll post the answer anyway! while (1) { digitalWrite(3, 1); digitalWrite(3, 0); } playground - BitMath Note: This page was inspired by a conversation that took place in the Arduino forum. Table of Contents Introduction Schematic for Arduino Sensor Shield v5.0 ? - Arduino Forum - Aurora It's very unfortunate that the term "Arduino" is used both for a specific company name and also for generic module compatibility from any manufacturer. Arduino is a trademark that many folk in various countries are only too happy to violate. Consider how easy it is to violate said trademark, BTW.

AttachInterrupt Reference Language | Libraries | Comparison | Changes Description Specifies a named Interrupt Service Routine (ISR) to call when an interrupt occurs. Replaces any previous function that was attached to the interrupt. Most Arduino boards have two external interrupts: numbers 0 (on digital pin 2) and 1 (on digital pin 3). Programming an ATtiny w/ Arduino This tutorial shows you how to program an ATtiny45 or ATtiny85 microcontroller using the Arduino software and hardware. The ATtiny45 and ATtiny85 are small (8-leg), cheap ($2-3) microcontrollers that are convenient for running simple programs. This tutorial is obsolete! See the updated version of this tutorial (with support for Arduino 1.0). They are almost identical, except that the ATtiny85 has twice the memory of the ATtiny45 and can therefore hold more complex programs.

RotaryEncoders - Aurora ALPS STEC12E07 Encoder A rotary or "shaft" encoder is an angular measuring device. It is used to precisely measure rotation of motors or to create wheel controllers (knobs) that can turn infinitely (with no end stop like a potentiometer has). AvailableMemory Note: For Arduino 1.0, you have to replace#include <WProgram.h>with#include <Arduino.h>. The microcontrollers used on Arduino boards (ATmega8, ATmega168 and ATmega328) have a small amount of RAM. In order to determine the amount of memory currently available the most accurate result can be found by using this MemoryFree library (2.21kb). It is based on code posted in the forum (here), extended to include walking the free list:

Better (Free) Graphical IDE Than Arduino...? OK, here's an example I'm currently using on the desktop side of things. Let's say I want to transmit data from the host to the micro, arranged in packets. Let's say I have the following defined data structures in C: Electronics : Microprocessors : How to process incoming serial data without blocking How to send and receive numbers To send a number (greater than 0 to 9) from one Arduino to another reliably you need to do a couple of things. Send some sort of "start number" delimiter (in this example, the "<" character)."Print" the number, which turns it into a string of ASCII characters.Send some sort of "end number" delimiter (in this example, the ">" character). Example sketch, sending 10 random numbers out the serial port: // Example of sending numbers by Serial // Author: Nick Gammon // Date: 31 March 2012 const char startOfNumberDelimiter = '<'; const char endOfNumberDelimiter = '>'; void setup () { srand (42); Serial.begin (115200); } // end of setup void loop () { Serial.println ("Starting ..."); for (int i = 0; i < 10; i++) { Serial.print (startOfNumberDelimiter); Serial.print (rand ()); // send the number Serial.print (endOfNumberDelimiter); Serial.println (); } // end of for delay (5000); } // end of loop

StepperUnipolar Learning Examples | Foundations | Hacking | Links This page shows two examples on how to drive a unipolar stepper motor. These motors can be found in old floppy drives and are easy to control. The one we use has 6 connectors of which one is power (VCC) and the other four are used to drive the motor sending synchronous signals. Optical mouse hacking, part 1 « Department of New Computings Arduino driver for the ADNS2610 follows the cut, along with sample implementation and a fairly straightforward Processing app to read the data. The part most people will care about is the first chunk. You should easily be able to adapt it to other chips like the ADNS2051. In porting, pay close attention to the procedure for reading out the framebuffer, as that seems to be the primary difference between chips. The registers are all different but the routines for reading and writing over the serial line are essentially identical, right down to the timing.