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 […]
All posts by
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
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 […]
Printing to the console / serial monitor
Use the UART – see here. Menu > Tools > Serial Monitor sop see its output Print const string Note the “F( )” avoids the compiler storing the string in RAM (dynamic) memory by default Enable the serial port Example Example – Displaying some values Print array as char string Printing Multiple Strings Print A […]
Nop (single cycle no operation)
__asm__("nop\n\t");
Using SPI Library
Resources https://www.arduino.cc/en/reference/SPI Arduino As SPI Master Arduino As SPI Slave
.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 […]
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.
EEPROM Library
The Arduino microcontrollers have non volatile EEPROM memory built in. The EEPROM library allows you to read and write those bytes. EEPROM Sizes: 1024 bytes ATmega328 512 bytes ATmega168 ATmega8 4KB (4096 bytes) ATmega1280 ATmega2560. Using The Library Note that you read and write one byte at a time – there is not an array read and […]
LiquidCrystal Library
LiquidCrystal Library Using The Library Basic Setup In your main sketch file //—– LCD DISPLAY —– #include <LiquidCrystal.h> LiquidCrystal lcd(12, 10, 11, 9, 8, 7, 6); //7 wire usage: (rs, rw, enable, d4, d5, d6, d7) If you want to use it in other files also #include <LiquidCrystal.h> extern LiquidCrystal lcd; Initialise //—– SETUP LCD […]