UNO-Comparator Interrupt

Initialise //Enable gobal interrupts (should already be enabled but do anyway) SREG = SREG | B10000000; Turning interrupt on //Enable analog comparator interrupt ACSR = B00000010; //On failing edge (bit 1=1), AIN0 applied to positive input of the analog comparator (bit6=0) ACSR = ACSR | B00001000; // Enable analog comparator interrupt (bit 3). Turning interrupt […]

Read More

Fast PWM Outputs

You can use the ATmega internal PWM peripherals to generate faster PWM outputs than the software based analogwrite(). Fast PWM Resources https://www.arduino.cc/en/Tutorial/SecretsOfArduinoPWM Registers & Bits Consult that datasheet for the ATmega used in the Arduino you are using as the exaxt bit usage varies between timers and between devices. There are 2 fast PWM modes. Fast PWM which […]

Read More

Timer1 Library

Arduino page for it here. Download from here or just install TimerOne using the Arduino libraries manager Using the Timer 1 Library For a Simple IRQ Timer

Read More

SoftwareSerial Library

Allows normal IO pins to be used as bit bashed UART pins Resources https://www.arduino.cc/en/Reference/SoftwareSerial http://arduiniana.org/libraries/newsoftserial/ Example Usage Receiving Data Note you can define unlimited software serial ports, but only 1 can be set to receive at a time. Using only 1 pin Using for RX only Defining both pins as PA5 on an ATtiny841 and using to […]

Read More

Printing to the console / serial monitor

Use the UART – see here.  Menu > Tools > Serial Monitor sop see its output Enable the serial port Strings Print const string Note the “F( )” avoids the compiler storing the string in RAM (dynamic) memory by default Print array as char string Printing Multiple Strings Print A Character Specific variable types Integer […]

Read More

.Arduino For C Programmers

If you're coming to Arduino from programming in C on other platforms then your skills are directly transferable of course as Arduino programming is C and C++. Here's our notes on issues to consider: (Yes an Arduino Project is a sketch – sorry but we call such things projects so you'll find we refer to […]

Read More

Rename Project

Open the Sketch Select the projects tab (if there is more than 1 project files file tab) Using the drop down arrow to the right of the tabs select 'Rename'.  This will rename the sketch and the folder it is in.

Read More