Friday, February 28, 2014

Arduino 1.5.6-r2

Arduino 1.5.6-r2 BETA released, with support for Arduino Yún and Arduino Due boards.

link: http://arduino.cc/en/Main/Software

Thursday, February 20, 2014

Send data from Android to Arduino Esplora in USB Host Mode

It's a exercise in my another blog "Android-er: Send Hello to Arduino from Android in USB Host Mode". The post show how to detect attached Arduino Esplora board on Android, run in USB Host Mode, and send data to it.

Flappy Bird in a Box Hack

Made with Arduino, two servo motors, reed switch, and magnets.

Real-Time C++: Efficient Object-Oriented and Template Microcontroller Programming

Real-Time C++: Efficient Object-Oriented and Template Microcontroller Programming
Real-Time C++: Efficient Object-Oriented and Template Microcontroller Programming
The C++ language has powerful object-oriented and template features that can improve software design and portability while simultaneously reducing code complexity and the risk of error. Furthermore, C++ compiles highly efficient native code. This unique and effective combination makes C++ well-suited for programming microcontroller systems that require compact size, high performance and safety-critical reliability.

With this book, Chris Kormanyos delivers a highly practical guide to programming real-time embedded microcontroller systems in C++. It is divided into three parts plus several appendices. Part I provides a foundation for real-time C++ by covering language technologies, including object-oriented methods, template programming and optimization. Next, part II presents detailed descriptions of a variety of C++ components that are widely used in microcontroller programming. It details some of C++’s most powerful language elements, such as class types, templates and the STL, to develop components for microcontroller register access, low-level drivers, custom memory management, embedded containers, multitasking, etc.  Finally, part III describes mathematical methods and generic utilities that can be employed to solve recurring problems in real-time C++. The appendices include a brief C++ language tutorial, information on the real-time C++ development environment and instructions for building GNU GCC cross-compilers and a microcontroller circuit.

The most recent specification of C++11 in ISO/IEC 14882:2011 is used throughout the text. To facilitate portability, no libraries other than those specified in the language standard itself are used. Efficiency is always in focus and numerous examples are backed up with real-time performance measurements and size analyses that quantify the true costs of the code down to the very last byte and microsecond.

The target audience of this book mainly consists of students and professionals interested in real-time C++. Readers should be familiar with C or another programming language and will benefit most if they have had some previous experience with microcontroller electronics and the performance and size issues prevalent in embedded systems programming.

Thursday, February 13, 2014

Arduino Day 2014 29th March

Arduino Day is a worldwide celebration of Arduino’s first 10 years. It's 24 hours full of events, on 29th March, 2014 – both official and independent, anywhere around the world – where people interested in Arduino can meet, share their experiences, and learn more.

link: http://day.arduino.cc/



Tuesday, February 11, 2014

Make: AVR Programming

Make: AVR Programming: Learning to Write Software for Hardware (Make : Technology on Your Time)
Make: AVR Programming
Make: AVR Programming
Atmel's AVR microcontrollers are the chips that power Arduino, and are the go-to chip for many hobbyist and hardware hacking projects. In this book you'll set aside the layers of abstraction provided by the Arduino environment and learn how to program AVR microcontrollers directly. In doing so, you'll get closer to the chip and you'll be able to squeeze more power and features out of it.

Each chapter of this book is centered around projects that incorporate that particular microcontroller topic. Each project includes schematics, code, and illustrations of a working project.
  • Program a range of AVR chips
  • Extend and re-use other people’s code and circuits
  • Interface with USB, I2C, and SPI peripheral devices
  • Learn to access the full range of power and speed of the microcontroller
  • Build projects including Cylon Eyes, a Square-Wave Organ, an AM Radio, a Passive Light-Sensor Alarm, Temperature Logger, and more
  • Understand what's happening behind the scenes even when using the Arduino IDE

Monday, February 10, 2014

Esplora example: read temperature sensor

This example read and display temperature sensor of Arduino Esplora on TFT screen, in celsius and fahrenheit.

Read temperature sensor on Arduino Esplora
Read temperature sensor on Arduino Esplora

#include <TFT.h>
#include <SPI.h>
#include <Esplora.h>

int celsius = 0;
int fahrenheit = 0;
char printoutC[3];
char printoutF[3];

void setup()
{
    EsploraTFT.begin();
    EsploraTFT.background(0,0,0);
    
    //preset dummy reading to print
    String dummy = "0";
    dummy.toCharArray(printoutC, 3);
    dummy.toCharArray(printoutC, 3);
    
    EsploraTFT.stroke(255,255,255);
    EsploraTFT.text("degree C: ", 0, 10);
    EsploraTFT.text("degree F: ", 0, 20);
} 

void loop()
{
    //read the temperature sensor
    celsius = Esplora.readTemperature(DEGREES_C);  
    fahrenheit = Esplora.readTemperature(DEGREES_F);

    //clear previous print of reading
    EsploraTFT.stroke(0,0,0);
    EsploraTFT.text(printoutC, 60, 10);
    EsploraTFT.text(printoutF, 60, 20);
    
    String(celsius).toCharArray(printoutC,3);
    String(fahrenheit).toCharArray(printoutF,3);
    EsploraTFT.stroke(255,255,255);
    EsploraTFT.text(printoutC, 60, 10);
    EsploraTFT.text(printoutF, 60, 20);

    delay(1000);
}

Monday, February 3, 2014

Arduino Cookbook, Second Edition

Arduino Cookbook, Second Edition
Want to create devices that interact with the physical world? This cookbook is perfect for anyone who wants to experiment with the popular Arduino microcontroller and programming environment. You'll find more than 200 tips and techniques for building a variety of objects and prototypes such as toys, detectors, robots, and interactive clothing that can sense and respond to touch, sound, position, heat, and light.

You don't need to have mastered Arduino or programming to get started. Updated for the Arduino 1.0 release, the recipes in this second edition include practical examples and guidance to help you begin, expand, and enhance your projects right away - whether you're an artist, designer, hobbyist, student, or engineer.

  • Get up to speed on the Arduino board and essential software concepts quickly
  • Learn basic techniques for reading digital and analog signals
  • Use Arduino with a variety of popular input devices and sensors
  • Drive visual displays, generate sound, and control several types of motors
  • Interact with devices that use remote controls, including Tvs and appliances
  • Learn techniques for handling time delays and time measurement
  • Apply advanced coding and memory handling techniques


Example of Timer Interrupt on Arduino

It's example to use Timer Interrupt of Arduino Esplora, to toggle RGB LED when timer interrupt reached.



testTimer.ino
#include <Esplora.h>

volatile boolean ledon;
volatile unsigned long lasttime;
volatile unsigned long now;
 
void setup() {
    ledon = true;
    Esplora.writeRGB(100, 100, 100);

    lasttime = millis();
    
    // initialize Timer1
    noInterrupts(); // disable all interrupts
    TCCR1A = 0;
    TCCR1B = 0;

    TCNT1 = 34286; // preload timer 65536-16MHz/256/2Hz
    TCCR1B |= (1 << CS12); // 256 prescaler
    TIMSK1 |= (1 << TOIE1); // enable timer overflow interrupt
    interrupts(); // enable all interrupts
    
}
 
void loop() {
 
}

ISR(TIMER1_OVF_vect)
{
    TCNT1 = 34286; // preload timer
    
    ledon = !ledon;
    if(ledon){
        Esplora.writeRGB(0, 0, 1);
    }else{
        Esplora.writeRGB(0, 0, 0);
    }
    
    now = millis();
    Serial.println(now - lasttime);
    lasttime = now;
}

reference: http://blog.oscarliang.net/arduino-timer-and-interrupt-tutorial/

Saturday, February 1, 2014

Programming Arduino Uno with Simulink



Install the Arduino® support package, create a simple model, and download the model to Arduino Uno using a step-by-step workflow with Simulink®.

For more information, please visit, http://www.mathworks.com/hardware-support/arduino-simulink.html