background preloader

Arduino

Facebook Twitter

Untitled. Untitled. Una vez que hemos instalado nuestra librería Arduino Menu, tal y como explicamos en el tutorial anterior, ahora vamos a comenzar a programar para crear nuestro menú personalizado.

untitled

Hay que tener en cuenta que cada vez que cliquemos sobre un elemento de nuestro menú pueden ejecutarse acciones distintas dependiendo de la opción del menú diseñada para ello. Entre las opciones de un menú nos encontramos: SELECT -> Selecciona la opción que hemos escogido y ejecuta una función.TOGGLE -> Modo palanca, solo permite 2 opciones activado o desactivado.CHOOSE -> Elige de entre un conjunto de opciones.VALUE -> Selecciona y modifica el valor de una variable asociado a este campo.FIELD -> Crea un campo que modifica una variable definida en un intervalo.OP -> OpcionesEXIT -> Sale del menu, para ir hacia otro Ahora explicaremos una por una, como se definen nuestras opciones y poco a poco iremos construyendo un menú completo.

Select es el modelo de eventMask. Untitled. Interrupts in C++ An ideal C++ device driver would be a class containing, among other things, the ISR as a member function.

Interrupts in C++

But this is harder to achieve than many C programmers assume. One of the goals of a recent project was to evaluate the effectiveness of C++ in writing low-level device drivers. With a push to reduce time to market, we were given a budget large enough to order some nice object modeling tools. Everyone in the team was experienced in using C in embedded systems. We also had a smattering of C++ experience in non-embedded applications. We designed and coded some nifty Timer and UART drivers in C++.

Arduino

Rotary encoder interrupt service routine for AVR micros « Circuits@Home. Encoder ISR About a year ago, I posted an article about 2-channel rotary encoder interfacing with MCU using lookup table.

Rotary encoder interrupt service routine for AVR micros « Circuits@Home

With its linear program flow, inherent noise immunity and small processing requirements, this method produces extremely efficient code. The article attracted quite a bit of attention with many interesting comments and several code modifications. Today, I want to demonstrate slightly different way of reading the encoder – via interrupt service routine (ISR). Reading rotary encoder on Arduino « Circuits@Home. Rotary encoder connected to Arduino Quadrature rotary encoders, also known as rotary pulse generators, are popular input devices for embedded platforms, including Arduino.

Reading rotary encoder on Arduino « Circuits@Home

Several rotary encoder code examples are posted on Arduino site and elsewhere, however, they treat encoder as a pair of switches, adding decoding/debouncing overhead. For many years, I used an algorithm based on the fact that quadrature encoder is a Gray code generator and if treated as such, can be read reliably in 3 straight step without need for debouncing. As a result, the code I’m using is very fast and simple, works very well with cheap low-quality encoders, but is somewhat cryptic and difficult to understand. Soon after posting one of my projects where I used rotary encoder to set motor speed i started receiving e-mails asking to explain the code. ATTiny USI I2C Introduction - A powerful, fast, and convenient communication interface for your ATTiny projects! I2C, it's a standard that's been around for around 20 years and has found uses in nearly every corner of the electronics universe.

ATTiny USI I2C Introduction - A powerful, fast, and convenient communication interface for your ATTiny projects!

It's an incredibly useful technology for us microcontroller hobbyists but can seem daunting for new users. This tutorial will solve that problem, first by reviewing what I2C is and how it works, then by going in-depth on how to implement I2C in Atmel's ATTiny USI (Universal Serial Interface) hardware. I2C is commonly used in GPIO expanders, EEPROM/Flash memory chips, temperature sensors, real-time clocks, LED drivers, and tons of other components.

If you spend much time looking for new, cool parts you'll probably wind up with several I2C parts. Fortunately it is a protocol that is available on most microcontrollers, though it is a bit more complex than others. I2C Tools of Interest: Before you dig too deep into I2C communications, you'll want to have some things on hand that will make your learning experience easier. 1. Guide to Arduino and AVR Communications. If you spend any time playing with Arduinos, ATtinys or looking at AVR spec sheets, you soon encounter a bewildering smörgåsbord of acronyms for various communication protocols.

Guide to Arduino and AVR Communications

With examples such as I2C, LIN, SPI, TWI, USI, etc., it can get pretty confusing. If you don’t believe me, just take a look communications column for Digikey’s listing for the ATmega series chips. Confused yet? What do these terms mean? How do you choose the chip that meets your needs? Communication Protocols The SPI (Serial Peripheral Interface) is the protocol used by the ICSP (in-circuit serial programming) facility transmitted over the ubiquitous 6-pin (2×3 pin) header used to program AVR chips. The Serial Peripheral Interface Bus or SPI (pronounced as either ess-pee-eye, spy or simply S.P.I) bus is a synchronous serial data link standard, named by Motorola, that operates in full duplex mode.

This protocol is known as both I2C (Inter-Integrated Circuit) and as TWI (two wire interface). And many more. Two Wire. NewSoftSerial  A New Software Serial Library for Arduino News: NewSoftSerial is in the core! Starting with Arduino 1.0 (December, 2011), NewSoftSerial has replaced the old SoftwareSerial library as the officially supported software serial library. This means that if you have 1.0 or later, you should not download this library. To port your code to 1.0, simply change all NewSoftSerial references to SoftwareSerial. NewSoftSerial is the latest of three Arduino libraries providing “soft” serial port support. NewSoftSerial Library, for an extra serial port.

NewSoftSerial, by Mikal Hart, emulates an additional serial port, allowing you to communicate with another serial device.

NewSoftSerial Library, for an extra serial port

Download: NewSoftSerial10c.zip Hardware Requirements UART Serial should always be used, if possible. NewSoftSerial imposes substantial CPU usage requirements. Only use NewSoftSerial when a second serial port is absolutely necessary. NewSoftSerial requires pin change interrupts for reception, which are only available on certain pins. Basic Usage NewSoftSerial mySerial(ReceivePin, TransmitPin);

Corrupt output/garbage from the ATmega328p. Hi everyone, I'm hoping someone here can help me with an issue I'm experiencing with the serial output from the ATmega328p on my GertDuino.

Corrupt output/garbage from the ATmega328p

First things first, my setup is a RPi Model B, NOOBS 1.2.1, Raspbian with a 16GB SD card. I've gone through the setup process detailed in the excellent GertDuino user manual and can successfully program and run the example programs (both raw C and Arduino sketches), see for more info. My issue comes when I try to communicate with the ATmega328p via serial. A beginner’s guide to connecting and operating the WiFly to Arduino Serially. We were working on a home automation project , we used the wifly gsx in our project .When we bought it, we thought it will be easy to communicate it like a serial modem between the arduino and PC ,,, of course we are not noobs :) but every inch in the datasheet made us feel like one :)And when we searched for a solution for even one of our countless problems we faced.... the result can be summarized in three words ...

A beginner’s guide to connecting and operating the WiFly to Arduino Serially

WIFLY NOT WORKING or we are noobs :D Of course i am kidding :) ,,we are not noobs and wifly is WORKING :o , thanks to sparkfun wifly library and We decided to start our new virtual hackerspace with this easy step by step tutorial for wifly :Please post any problem you faced with wifly or arduino . boolean initSettings() WiFly.SendCommand("set wlan auth <value>","AOK"); //WiFly.SendCommand("set wlan key <value>","AOK"); WiFly.SendCommand("set wlan channel <value>","AOK"); WiFly.SendCommand("set wlan join <value>","AOK"); Arduino/hardware/arduino/avr/libraries/SoftwareSerial at master · arduino/Arduino.