neingeist
/
arduinisten
Archived
1
0
Fork 0

initial commit

master
Eve Entropia 15 years ago
commit 617bdc2d29

@ -0,0 +1 @@
../arduino-0017/hardware/libraries/LCD4Bit

@ -0,0 +1,232 @@
/*
LCD4Bit v0.1 16/Oct/2006 neillzero http://abstractplain.net
What is this?
An arduino library for comms with HD44780-compatible LCD, in 4-bit mode (saves pins)
Sources:
- The original "LiquidCrystal" 8-bit library and tutorial
http://www.arduino.cc/en/uploads/Tutorial/LiquidCrystal.zip
http://www.arduino.cc/en/Tutorial/LCDLibrary
- DEM 16216 datasheet http://www.maplin.co.uk/Media/PDFs/N27AZ.pdf
- Massimo's suggested 4-bit code (I took initialization from here) http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1144924220/8
See also:
- glasspusher's code (probably more correct): http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1160586800/0#0
Tested only with a DEM 16216 (maplin "N27AZ" - http://www.maplin.co.uk/Search.aspx?criteria=N27AZ)
If you use this successfully, consider feeding back to the arduino wiki with a note of which LCD it worked on.
Usage:
see the examples folder of this library distribution.
*/
#include "LCD4Bit.h"
extern "C" {
#include <stdio.h> //not needed yet
#include <string.h> //needed for strlen()
#include <inttypes.h>
#include "WConstants.h" //all things wiring / arduino
}
//command bytes for LCD
#define CMD_CLR 0x01
#define CMD_RIGHT 0x1C
#define CMD_LEFT 0x18
#define CMD_HOME 0x02
// --------- PINS -------------------------------------
//is the RW pin of the LCD under our control? If we're only ever going to write to the LCD, we can use one less microcontroller pin, and just tie the LCD pin to the necessary signal, high or low.
//this stops us sending signals to the RW pin if it isn't being used.
int USING_RW = false;
//RS, RW and Enable can be set to whatever you like
int RS = 12;
int RW = 11;
int Enable = 2;
//DB should be an unseparated group of pins - because of lazy coding in pushNibble()
int DB[] = {7, 8, 9, 10}; //wire these to DB4~7 on LCD.
//--------------------------------------------------------
//how many lines has the LCD? (don't change here - specify on calling constructor)
int g_num_lines = 2;
//pulse the Enable pin high (for a microsecond).
//This clocks whatever command or data is in DB4~7 into the LCD controller.
void LCD4Bit::pulseEnablePin(){
digitalWrite(Enable,LOW);
delayMicroseconds(1);
// send a pulse to enable
digitalWrite(Enable,HIGH);
delayMicroseconds(1);
digitalWrite(Enable,LOW);
delay(1); // pause 1 ms. TODO: what delay, if any, is necessary here?
}
//push a nibble of data through the the LCD's DB4~7 pins, clocking with the Enable pin.
//We don't care what RS and RW are, here.
void LCD4Bit::pushNibble(int value){
int val_nibble= value & 0x0F; //clean the value. (unnecessary)
for (int i=DB[0]; i <= DB[3]; i++) {
digitalWrite(i,val_nibble & 01);
val_nibble >>= 1;
}
pulseEnablePin();
}
//push a byte of data through the LCD's DB4~7 pins, in two steps, clocking each with the enable pin.
void LCD4Bit::pushByte(int value){
int val_lower = value & 0x0F;
int val_upper = value >> 4;
pushNibble(val_upper);
pushNibble(val_lower);
}
//stuff the library user might call---------------------------------
//constructor. num_lines must be 1 or 2, currently.
LCD4Bit::LCD4Bit (int num_lines) {
g_num_lines = num_lines;
if (g_num_lines < 1 || g_num_lines > 2)
{
g_num_lines = 1;
}
}
void LCD4Bit::commandWriteNibble(int nibble) {
digitalWrite(RS, LOW);
if (USING_RW) { digitalWrite(RW, LOW); }
pushNibble(nibble);
}
void LCD4Bit::commandWrite(int value) {
digitalWrite(RS, LOW);
if (USING_RW) { digitalWrite(RW, LOW); }
pushByte(value);
//TODO: perhaps better to add a delay after EVERY command, here. many need a delay, apparently.
}
//print the given character at the current cursor position. overwrites, doesn't insert.
void LCD4Bit::print(int value) {
//set the RS and RW pins to show we're writing data
digitalWrite(RS, HIGH);
if (USING_RW) { digitalWrite(RW, LOW); }
//let pushByte worry about the intricacies of Enable, nibble order.
pushByte(value);
}
//print the given string to the LCD at the current cursor position. overwrites, doesn't insert.
//While I don't understand why this was named printIn (PRINT IN?) in the original LiquidCrystal library, I've preserved it here to maintain the interchangeability of the two libraries.
void LCD4Bit::printIn(char msg[]) {
uint8_t i; //fancy int. avoids compiler warning when comparing i with strlen()'s uint8_t
for (i=0;i < strlen(msg);i++){
print(msg[i]);
}
}
//send the clear screen command to the LCD
void LCD4Bit::clear(){
commandWrite(CMD_CLR);
delay(1);
}
// initiatize lcd after a short pause
//while there are hard-coded details here of lines, cursor and blink settings, you can override these original settings after calling .init()
void LCD4Bit::init () {
pinMode(Enable,OUTPUT);
pinMode(RS,OUTPUT);
if (USING_RW) { pinMode(RW,OUTPUT); }
pinMode(DB[0],OUTPUT);
pinMode(DB[1],OUTPUT);
pinMode(DB[2],OUTPUT);
pinMode(DB[3],OUTPUT);
delay(50);
//The first 4 nibbles and timings are not in my DEM16217 SYH datasheet, but apparently are HD44780 standard...
commandWriteNibble(0x03);
delay(5);
commandWriteNibble(0x03);
delayMicroseconds(100);
commandWriteNibble(0x03);
delay(5);
// needed by the LCDs controller
//this being 2 sets up 4-bit mode.
commandWriteNibble(0x02);
commandWriteNibble(0x02);
//todo: make configurable by the user of this library.
//NFXX where
//N = num lines (0=1 line or 1=2 lines).
//F= format (number of dots (0=5x7 or 1=5x10)).
//X=don't care
int num_lines_ptn = g_num_lines - 1 << 3;
int dot_format_ptn = 0x00; //5x7 dots. 0x04 is 5x10
commandWriteNibble(num_lines_ptn | dot_format_ptn);
delayMicroseconds(60);
//The rest of the init is not specific to 4-bit mode.
//NOTE: we're writing full bytes now, not nibbles.
// display control:
// turn display on, cursor off, no blinking
commandWrite(0x0C);
delayMicroseconds(60);
//clear display
commandWrite(0x01);
delay(3);
// entry mode set: 06
// increment automatically, display shift, entire shift off
commandWrite(0x06);
delay(1);//TODO: remove unnecessary delays
}
//non-core stuff --------------------------------------
//move the cursor to the given absolute position. line numbers start at 1.
//if this is not a 2-line LCD4Bit instance, will always position on first line.
void LCD4Bit::cursorTo(int line_num, int x){
//first, put cursor home
commandWrite(CMD_HOME);
//if we are on a 1-line display, set line_num to 1st line, regardless of given
if (g_num_lines==1){
line_num = 1;
}
//offset 40 chars in if second line requested
if (line_num == 2){
x += 40;
}
//advance the cursor to the right according to position. (second line starts at position 40).
for (int i=0; i<x; i++) {
commandWrite(0x14);
}
}
//scroll whole display to left
void LCD4Bit::leftScroll(int num_chars, int delay_time){
for (int i=0; i<num_chars; i++) {
commandWrite(CMD_LEFT);
delay(delay_time);
}
}
//Improvements ------------------------------------------------
//Remove the unnecessary delays (e.g. from the end of pulseEnablePin()).
//Allow the user to pass the pins to be used by the LCD in the constructor, and store them as member variables of the class instance.
//-------------------------------------------------------------

@ -0,0 +1,27 @@
#ifndef LCD4Bit_h
#define LCD4Bit_h
#include <inttypes.h>
class LCD4Bit {
public:
LCD4Bit(int num_lines);
void commandWrite(int value);
void init();
void print(int value);
void printIn(char value[]);
void clear();
//non-core---------------
void cursorTo(int line_num, int x);
void leftScroll(int chars, int delay_time);
//end of non-core--------
//4bit only, therefore ideally private but may be needed by user
void commandWriteNibble(int nibble);
private:
void pulseEnablePin();
void pushNibble(int nibble);
void pushByte(int value);
};
#endif

@ -0,0 +1,47 @@
//example use of LCD4Bit library
#include <LCD4Bit.h>
//create object to control an LCD.
//number of lines in display=1
LCD4Bit lcd = LCD4Bit(1);
//some messages to display on the LCD
char msgs[6][15] = {"apple", "banana", "pineapple", "mango", "watermelon", "pear"};
int NUM_MSGS = 6;
void setup() {
pinMode(13, OUTPUT); //we'll use the debug LED to output a heartbeat
lcd.init();
//optionally, now set up our application-specific display settings, overriding whatever the lcd did in lcd.init()
//lcd.commandWrite(0x0F);//cursor on, display on, blink on. (nasty!)
}
void loop() {
digitalWrite(13, HIGH); //light the debug LED
//pick a random message from the array
int pick = random(NUM_MSGS);
char* msg = msgs[pick];
lcd.clear();
lcd.printIn(msg);
delay(1000);
digitalWrite(13, LOW);
//print some dots individually
for (int i=0; i<3; i++){
lcd.print('.');
delay(100);
}
//print something on the display's second line.
//uncomment this if your display HAS two lines!
/*
lcd.cursorTo(2, 0); //line=2, x=0.
lcd.printIn("Score: 6/7");
delay(1000);
*/
//scroll entire display 20 chars to left, delaying 50ms each inc
lcd.leftScroll(20, 50);
}

@ -0,0 +1,27 @@
#######################################
# Syntax Coloring Map For Matrix
#######################################
#######################################
# Datatypes (KEYWORD1)
#######################################
LCD4Bit KEYWORD1
#######################################
# Methods and Functions (KEYWORD2)
#######################################
clear KEYWORD2
commandWrite KEYWORD2
cursorTo KEYWORD2
init KEYWORD2
leftScroll KEYWORD2
print KEYWORD2
printIn KEYWORD2
commandWriteNibble KEYWORD2
#######################################
# Constants (LITERAL1)
#######################################

@ -0,0 +1,38 @@
This is a C++ library for Arduino for controlling an HD74800-compatible LCD in 4-bit mode.
Tested on Arduino 0005 Alpha.
Installation
--------------------------------------------------------------------------------
To install this library, just place this entire folder as a subfolder in your
Arduino/lib/targets/libraries folder.
When installed, this library should look like:
Arduino/lib/targets/libraries/LCD4Bit (this library's folder)
Arduino/lib/targets/libraries/LCD4Bit/LCD4Bit.cpp (the library implementation file)
Arduino/lib/targets/libraries/LCD4Bit/LCD4Bit.h (the library description file)
Arduino/lib/targets/libraries/LCD4Bit/keywords.txt (the syntax coloring file)
Arduino/lib/targets/libraries/LCD4Bit/examples (the examples in the "open" menu)
Arduino/lib/targets/libraries/LCD4Bit/readme.txt (this file)
Building
--------------------------------------------------------------------------------
After this library is installed, you just have to start the Arduino application.
You may see a few warning messages as it's built.
To use this library in a sketch, go to the Sketch | Import Library menu and
select LCD4Bit. This will add a corresponding line to the top of your sketch:
#include <LCD4Bit.h>
To stop using this library, delete that line from your sketch.
Geeky information:
After a successful build of this library, a new file named "LCD4Bit.o" will appear
in "Arduino/lib/targets/libraries/LCD4Bit". This file is the built/compiled library
code.
If you choose to modify the code for this library (i.e. "LCD4Bit.cpp" or "LCD4Bit.h"),
then you must first 'unbuild' this library by deleting the "LCD4Bit.o" file. The
new "LCD4Bit.o" with your code will appear after the next press of "verify"

@ -0,0 +1,38 @@
#include <LCD4Bit.h>
LCD4Bit lcd = LCD4Bit(2);
void setup() {
lcd.init();
lcd.clear();
lcd.printIn("World Arduinination in progress...");
}
int i = 0,j = 0, dir = 1;
char bfr[4];
void loop() {
digitalWrite(13, HIGH);
lcd.cursorTo(2, 0);
itoa(i, bfr, 10);
lcd.printIn(bfr);
lcd.printIn("%");
lcd.cursorTo(2, 4);
for(j=0; j < (i / 3); j++)
lcd.print(255);
for(j=i/3; j < 100/3; j++)
lcd.printIn(" ");
if(i >= 98)
dir = -1;
if(dir == -1 && i <= 80)
dir = 1;
i += dir;
digitalWrite(13,LOW);
delay(100);
}

Binary file not shown.

@ -0,0 +1,54 @@
// Wire Master Writer
// by Nicholas Zambetti <http://www.zambetti.com>
// Demonstrates use of the Wire library
// Writes data to an I2C/TWI slave device
// Refer to the "Wire Slave Receiver" example for use with this
// Created 29 March 2006
#include <Wire.h>
#include "WProgram.h"
void setup();
void loop();
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600);
}
byte x = 0;
void loop()
{
Wire.beginTransmission(4); // transmit to device #4
Wire.send("x is "); // sends five bytes
Wire.send(x); // sends one byte
Wire.endTransmission(); // stop transmitting
//Wire.requestFrom(2,2);
while(Wire.available()) // loop through all but the last
{
char c = Wire.receive(); // receive byte as a character
Serial.print(c); // print the character
}
x++;
delay(500);
Serial.print(".");
}
int main(void)
{
init();
setup();
for (;;)
loop();
return 0;
}

@ -0,0 +1,245 @@
:100000000C9436000C945E000C945E000C945E0020
:100010000C945E000C945E000C945E000C945E00E8
:100020000C945E000C945E000C945E000C945E00D8
:100030000C945E000C945E000C945E000C945E00C8
:100040000C948D040C945E000C9439050C945E00A5
:100050000C945E000C945E000C945E000C945E00A8
:100060000C948E020C945E00A501820611241FBE22
:10007000CFEFD4E0DEBFCDBF11E0A0E0B1E0ECE116
:10008000FFE002C005900D92A831B107D9F711E049
:10009000A8E1B1E001C01D92AA3DB107E1F710E06F
:1000A000CCE6D0E004C02297FE010E948807C83643
:1000B000D107C9F70E9486040C948C070C940000A9
:1000C0000F931F93CF93DF93689F8001699F100D5B
:1000D000789F100D1124C8010E947C00EC0100974C
:1000E00029F060E070E0A8010E947B01CE01DF9161
:1000F000CF911F910F910895CF93DF93BC01823070
:10010000910510F462E070E0A091D801B091D9019E
:10011000ED01E0E0F0E040E050E021C0888199810D
:100120008617970769F48A819B81309719F093832A
:10013000828304C09093D9018093D801FE0133C01B
:100140006817790738F44115510519F08417950798
:1001500008F4AC01FE018A819B819C01E901209792
:10016000E9F641155105A1F1CA01861B970B0497C9
:1001700008F4BA01E0E0F0E029C08D919C9111975C
:1001800084179507F1F46417750779F4ED018A81F6
:100190009B81309719F09383828304C09093D90197
:1001A0008093D801FD0132964CC0CA01861B970B83
:1001B000FD01E80FF91F6193719302978D939C9352
:1001C00040C0FD01828193819C01D9011097A9F65D
:1001D0008091D6019091D701892B41F480910A0139
:1001E00090910B019093D7018093D60140910C011F
:1001F00050910D014115510541F44DB75EB7809105
:10020000080190910901481B590B2091D6013091AA
:10021000D701CA01821B930B8617970780F0AB01A9
:100220004E5F5F4F8417950750F0420F531F509356
:10023000D7014093D601F9016193719302C0E0E0C8
:10024000F0E0CF01DF91CF910895CF93DF93009736
:1002500009F44EC0EC0122971B821A82A091D801AA
:10026000B091D901109701F140E050E0AC17BD0703
:1002700000F1BB83AA83FE0121913191E20FF31FAC
:10028000AE17BF0771F48D919C911197280F391FFC
:100290002E5F3F4F39832883FD01828193819B83A9
:1002A0008A834115510569F4D093D901C093D801CF
:1002B0001FC0FD0182819381AD01009711F0DC0127
:1002C000D5CFFA01D383C28321913191E20FF31F7D
:1002D000CE17DF0769F488819981280F391F2E5FB7
:1002E0003F4FFA01318320838A819B8193838283EC
:1002F000DF91CF910895DC0101C06D9341505040D2
:10030000E0F7089581E08093210160931C01109231
:100310001F0110922001089580911B0190911A01F4
:10032000891B089590911A0180911B01981710F074
:1003300080E00895E0911801F0911901E90FF11D95
:1003400080819F5F90931A0108950895DF93CF9362
:100350000F92CDB7DEB76983809121018823A9F080
:10036000809120018032B0F480911F01E0911D0145
:10037000F0911E01E80FF11D608380911F018F5FD6
:1003800080931F018093200105C0CE01019661E09A
:100390000E9471020F90CF91DF910895EF92FF922A
:1003A0000F931F93CF93DF937C01042F8091210142
:1003B000882359F0EB0110E005C0C70169910E9444
:1003C000A6011F5F1017C8F304C0CB01642F0E9461
:1003D0007102DF91CF911F910F91FF90EF900895DF
:1003E000DB010D900020E9F71197A61BB70B4A2FF0
:1003F0000E94CE01089560911D0170911E018091AF
:100400001C014091200121E00E942C0210921F014A
:100410001092200110922101089580E290E061E0A5
:1004200070E00E946000809318019093190110926F
:100430001A0110921B0180E290E061E070E00E94DE
:10044000600080931D0190931E0110921F01109275
:1004500020010E94100408951F93582F122F41323B
:1004600010F081E03CC0809123018823E1F782E015
:10047000809323018FEF8093340110922B014093DE
:100480002C01A0912901B0912A01FB0102C08191A8
:100490008D938E2F861B8417D0F3852F90E0880FC5
:1004A000991F8093240185EE8093BC00112321F0D5
:1004B000809123018230E1F3809134018F3F11F468
:1004C00080E00DC080913401803211F482E007C0D9
:1004D00080913401803311F084E001C083E01F91EA
:1004E0000895482F613210F081E008958091230132
:1004F000843011F082E0089560933001A0912D01C5
:10050000B0912E01842F9C01F90102C081918D933D
:100510008E2F841B8617D0F380E008951F920F92D0
:100520000FB60F9211242F933F934F935F936F93C6
:100530007F938F939F93AF93BF93EF93FF9380919C
:10054000B90090E0887F90708036910509F4E2C090
:1005500081369105CCF58832910509F47BC089324A
:100560009105B4F48031910509F46FC08131910592
:100570003CF4009709F438C1089709F040C165C000
:100580008831910509F466C0809709F038C17FC0B1
:100590008034910509F4A3C08134910544F480337B
:1005A000910509F47FC0C89709F029C186C080353C
:1005B000910509F486C08835910509F495C0883401
:1005C000910509F01CC19EC08839910509F404C148
:1005D00089399105ECF48837910509F49BC0893776
:1005E00091054CF48836910509F494C08037910543
:1005F00009F005C18FC08838910509F4EDC0803934
:10060000910509F48DC08038910509F0F8C088C0C3
:10061000803B910509F4B2C0813B91054CF4803ACE
:10062000910509F491C0883A910509F0E8C0A6C087
:10063000803C910509F4D4C0883C910509F4D0C0F0
:10064000883B910509F0DBC0B1C080912401809303
:10065000BB00C0C090912B0180912C01981778F4B9
:1006600090912B01E0912901F0912A01E90FF11DF0
:1006700080818093BB009F5F90932B01ABC085ED81
:100680008093BC008091BC0084FDFCCFB6C080E2AA
:100690008093340185ED8093BC008091BC0084FD83
:1006A000FCCFABC080E38093340185ED8093BC0028
:1006B0008091BC0084FDFCCFA0C088E3809334010E
:1006C0008FC080912B019091BB00E0912901F091A6
:1006D0002A01E80FF11D90838F5F80932B01909189
:1006E0002B0180912C0174C080912B019091BB0053
:1006F000E0912901F0912A01E80FF11D90838F5FAD
:1007000080932B0185ED8093BC008091BC0084FD1B
:10071000FCCF73C083E080932301109233015AC051
:1007200080913301803208F057C08091330190915D
:10073000BB00E0913101F0913201E80FF11D90838F
:100740008F5F8093330146C080913301803248F43B
:1007500080913301E0913101F0913201E80FF11DF8
:10076000108260913301E0912701F091280180917E
:1007700031019091320170E0099532C084E080939C
:10078000230110922F0110923001E0912501F09188
:100790002601099580913001882341F481E08093FE
:1007A0003001E0912D01F0912E01108290912F01E6
:1007B000E0912D01F0912E01E90FF11D80818093D0
:1007C000BB009F5F90932F0190912F01809130018A
:1007D000981710F485EC01C085E88093BC000FC029
:1007E00085EC8093BC0009C01092340185ED8093A4
:1007F000BC008091BC0084FDFCCF10922301FF91CE
:10080000EF91BF91AF919F918F917F916F915F9188
:100810004F913F912F910F900FBE0F901F90189501
:1008200010922301449A459AE9EBF0E080818E7F93
:10083000808380818D7F808388E48093B80085E405
:100840008093BC0080E290E061E070E00E94600074
:100850008093290190932A0180E290E061E070E0AA
:100860000E94600080932D0190932E0180E290E021
:1008700061E070E00E94600080933101909332014A
:10088000089582E291E064E070E00E94820182E2D9
:1008900091E060E071E00E94F00182E291E06091FD
:1008A00035010E94A60182E291E00E94FB0109C08D
:1008B00082E291E00E949201682F83EC91E00E9415
:1008C000F30682E291E00E948C01882389F78091EF
:1008D00035018F5F8093350164EF71E080E090E037
:1008E0000E94D50483EC91E066E071E00E94FB0673
:1008F000089582E291E00E940D0283EC91E040E8CD
:1009000055E260E070E00E94760508950E94FF04C1
:100910000E9479040E944104FDCF1F920F920FB6EE
:100920000F9211242F933F938F939F93AF93BF9375
:1009300080913A0190913B01A0913C01B0913D0121
:1009400030913E010196A11DB11D232F2D5F2D3742
:1009500020F02D570196A11DB11D20933E018093DB
:100960003A0190933B01A0933C01B0933D018091EB
:10097000360190913701A0913801B091390101966B
:10098000A11DB11D8093360190933701A0933801CA
:10099000B0933901BF91AF919F918F913F912F916A
:1009A0000F900FBE0F901F901895EF92FF920F932C
:1009B0001F937B018C018FB7F89440913A015091BD
:1009C0003B0160913C0170913D018FBF2FB7F894BE
:1009D00080913A0190913B01A0913C01B0913D0181
:1009E0002FBF841B950BA60BB70BE816F9060A0759
:1009F0001B0760F71F910F91FF90EF900895789477
:100A000084B5826084BD84B5816084BD85B5826013
:100A100085BD85B5816085BDEEE6F0E080818160B1
:100A20008083E1E8F0E08081826080838081816062
:100A30008083E0E8F0E0808181608083E1EBF0E09A
:100A4000808184608083E0EBF0E08081816080833E
:100A5000EAE7F0E080818460808380818260808327
:100A60008081816080838081806880831092C10052
:100A700008951F920F920FB60F9211242F933F9358
:100A80004F935F936F937F938F939F93AF93BF9396
:100A9000EF93FF934091C600E091BF01F091C00138
:100AA000CF01019660E870E00E9422079C018091CE
:100AB000C1019091C2012817390739F0E15CFE4F5E
:100AC00040833093C0012093BF01FF91EF91BF910C
:100AD000AF919F918F917F916F915F914F913F91D6
:100AE0002F910F900FBE0F901F9018955F926F92ED
:100AF0007F928F929F92AF92BF92CF92DF92EF92AE
:100B0000FF920F931F93CF93DF93EC013A014B01B8
:100B1000413482E458078FE0680780E078070CF0E2
:100B20007FC060E874E88EE190E0A40193010E9428
:100B300057072150304040405040CA01B90122E0DF
:100B400030E040E050E00E94570759016A01A601D9
:100B50009501209530954095509594E0220F331FD4
:100B6000441F551F9A95D1F760E074E284EF90E03E
:100B70000E945707CA01B9012FEF30E040E050E072
:100B80000E940307A40193010E945707C9018150E5
:100B90009F4F181619061CF4522E5A9403C0552460
:100BA0005394521A60E079E08DE390E0A401930140
:100BB0000E9457072150304040405040CA01B901BF
:100BC00022E030E040E050E00E9457072095309549
:100BD0004095509583E0220F331F441F551F8A957F
:100BE000D1F760E074E284EF90E00E945707CA01F9
:100BF000B9012FEF30E040E050E00E940307A4016C
:100C000093010E945707C90181509F4F181619067A
:100C10001CF4822F815002C081E0821B851500F5F3
:100C2000E885F98581E090E00A8802C0880F991F65
:100C30000A94E2F7808360E079E08DE390E0A4011C
:100C400093010E9457072150304040405040CA0154
:100C5000B90122E030E040E050E00E94570704C0B4
:100C6000E885F98510829501EC81FD813083EE8164
:100C7000FF812083EA85FB85208141E050E0CA01A5
:100C80000E8402C0880F991F0A94E2F7282B208354
:100C9000EA85FB852081CA010F8402C0880F991F55
:100CA0000A94E2F7282B2083EA85FB858081088857
:100CB00002C0440F551F0A94E2F7842B8083DF9112
:100CC000CF911F910F91FF90EF90DF90CF90BF9049
:100CD000AF909F908F907F906F905F900895FC01F0
:100CE000A085B18521898C9190E0022E02C0959556
:100CF00087950A94E2F780FFF6CF0484F585E02D0E
:100D00006083089582E191E09093C4018093C301D0
:100D10008FE391E09093C6018093C50185EC90E04C
:100D20009093C8018093C70184EC90E09093CA012E
:100D30008093C90180EC90E09093CC018093CB012B
:100D400081EC90E09093CE018093CD0186EC90E011
:100D50009093D0018093CF0184E08093D10183E010
:100D60008093D20187E08093D30185E08093D40102
:100D700081E08093D50108950F931F93CF93DF9364
:100D80008C01EB0109C02196D801ED91FC910190F5
:100D9000F081E02DC801099568816623A1F7DF91F4
:100DA000CF911F910F910895EF92FF920F931F9390
:100DB000CF93DF938C017B01EA010CC0D7016D91C9
:100DC0007D01D801ED91FC910190F081E02DC801E9
:100DD00009952197209791F7DF91CF911F910F915E
:100DE000FF90EF900895DC01ED91FC910190F0816E
:100DF000E02D09950895DC01ED91FC910280F381CD
:100E0000E02D09950895629FD001739FF001829FA4
:100E1000E00DF11D649FE00DF11D929FF00D839F89
:100E2000F00D749FF00D659FF00D9927729FB00D26
:100E3000E11DF91F639FB00DE11DF91FBD01CF0139
:100E40001124089597FB092E07260AD077FD04D0B8
:100E500049D006D000201AF4709561957F4F08950F
:100E6000F6F7909581959F4F0895A1E21A2EAA1B3F
:100E7000BB1BFD010DC0AA1FBB1FEE1FFF1FA2174A
:100E8000B307E407F50720F0A21BB30BE40BF50B47
:100E9000661F771F881F991F1A9469F760957095D0
:100EA000809590959B01AC01BD01CF01089597FB02
:100EB000092E05260ED057FD04D0D7DF0AD0001C1E
:100EC00038F450954095309521953F4F4F4F5F4FE7
:100ED0000895F6F790958095709561957F4F8F4FA7
:100EE0009F4F0895AA1BBB1B51E107C0AA1FBB1F40
:100EF000A617B70710F0A61BB70B881F991F5A95A6
:100F0000A9F780959095BC01CD010895EE0FFF1FC4
:0C0F10000590F491E02D0994F894FFCFB7
:100F1C007820697320002E002000DA010000000008
:080F2C0000006F06BC06D406AC
:00000001FF

@ -0,0 +1,38 @@
// Wire Master Writer
// by Nicholas Zambetti <http://www.zambetti.com>
// Demonstrates use of the Wire library
// Writes data to an I2C/TWI slave device
// Refer to the "Wire Slave Receiver" example for use with this
// Created 29 March 2006
#include <Wire.h>
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600);
}
byte x = 0;
void loop()
{
Wire.beginTransmission(4); // transmit to device #4
Wire.send("x is "); // sends five bytes
Wire.send(x); // sends one byte
Wire.endTransmission(); // stop transmitting
//Wire.requestFrom(2,2);
while(Wire.available()) // loop through all but the last
{
char c = Wire.receive(); // receive byte as a character
Serial.print(c); // print the character
}
x++;
delay(500);
Serial.print(".");
}

@ -0,0 +1,81 @@
#include <avr/interrupt.h>
#include <avr/io.h>
#include "WProgram.h"
void setup();
void loop();
int pinA = 11;
int pinB = 12;
int ledPin = 13;
void setup() {
//Timer2 Settings
TCCR2A = 0;
TCCR2B = 0<<CS22 | 1<<CS21 | 0<<CS20;
//Timer2 Overflow Interrupt Enable
TIMSK2 = 1<<TOIE2;
// pullups
digitalWrite(pinA, HIGH);
digitalWrite(pinB, HIGH);
Serial.begin(9600);
}
volatile int8_t enc_delta; // -128 ... 127
static int8_t last;
ISR(TIMER2_OVF_vect) {
int8_t neu, diff;
// convert gray to binary
neu = 0;
if(digitalRead(pinA))
neu = 3;
if(digitalRead(pinB))
neu ^= 1;
diff = last - neu; // difference last - new
if( diff & 1 ) { // bit 0 = value (1)
last = neu; // store new as next last
enc_delta += (diff & 2) - 1; // bit 1 = direction (+/-)
}
}
int8_t val_alt;
void loop() {
int8_t val;
digitalWrite(13,HIGH);
cli();
val = enc_delta;
// enc_delta = val & 1;
sei();
if (val != val_alt) {
Serial.println(val>>1);
}
val_alt = val;
delay(100);
digitalWrite(13,LOW);
delay(100);
}
int main(void)
{
init();
setup();
for (;;)
loop();
return 0;
}

@ -0,0 +1,180 @@
:100000000C9462000C948A000C948A000C948A0070
:100010000C948A000C948A000C948A000C948A0038
:100020000C948A000C94B7000C948A000C948A00FB
:100030000C948A000C948A000C948A000C948A0018
:100040000C94B8010C948A000C9464020C948A00FD
:100050000C948A000C948A000C948A000C948A00F8
:100060000C948A000C948A000000000024002700F1
:100070002A0000000000250028002B0000000000DE
:1000800023002600290004040404040404040202DA
:100090000202020203030303030301020408102007
:1000A0004080010204081020010204081020000012
:1000B0000007000201000003040600000000000029
:1000C0000000AD0311241FBECFEFD4E0DEBFCDBFD3
:1000D00011E0A0E0B1E0EEE1FBE002C005900D927E
:1000E000AE30B107D9F711E0AEE0B1E001C01D922A
:1000F000A13BB107E1F710E0C4ECD0E004C02297C7
:10010000FE010E948905C23CD107C9F70E94150172
:100110000C948D050C9400001F938DE061E00E940B
:100120001C01F89410910E01789480910F0118171A
:1001300051F0612F772767FD7095759567958EE96A
:1001400091E00E94F40410930F0164E670E080E0F7
:1001500090E00E9400028DE060E00E941C0164E6D5
:1001600070E080E090E00E9400021F9108951F92CD
:100170000F920FB60F9211241F932F933F934F931B
:100180005F936F937F938F939F93AF93BF93EF93FF
:10019000FF93809100010E946901892B11F013E007
:1001A00001C010E0809102010E946901892B11F0C9
:1001B00081E0182790911001911B90FF09C01093C6
:1001C000100180910E0181509270890F80930E0171
:1001D000FF91EF91BF91AF919F918F917F916F911F
:1001E0005F914F913F912F911F910F900FBE0F90F4
:1001F0001F9018951092B00082E08093B10081E0CA
:10020000809370008091000161E00E941C01809148
:10021000020161E00E941C018EE991E040E855E294
:1002200060E070E00E94A10208950E942A020E94EC
:10023000FA000E948C00FDCF482F50E0CA01825581
:100240009F4FFC012491CA0186569F4FFC01949157
:100250004A575F4FFA0134913323D1F1222331F110
:10026000233021F4809180008F7705C0243031F451
:10027000809180008F7D8093800018C0213019F418
:1002800084B58F7704C0223021F484B58F7D84BD7E
:100290000DC0263021F48091B0008F7705C0273043
:1002A00029F48091B0008F7D8093B000E32FF0E0BF
:1002B000EE0FFF1FEE58FF4FA591B491662329F46E
:1002C0008C91909589238C9308958C91892B8C9394
:1002D0000895682F70E0CB0182559F4FFC01249157
:1002E000CB0186569F4FFC0144916A577F4FFB011B
:1002F0009491992319F420E030E038C0222331F1A1
:10030000233021F4809180008F7705C0243031F4B0
:10031000809180008F7D8093800018C0213019F477
:1003200084B58F7704C0223021F484B58F7D84BDDD
:100330000DC0263021F48091B0008F7705C02730A2
:1003400029F48091B0008F7D8093B000892F90E0D8
:10035000880F991F84589F4FFC01A591B4918C91EF
:1003600020E030E0842311F021E030E0C90108955D
:100370001F920F920FB60F9211242F933F938F93DA
:100380009F93AF93BF938091150190911601A09117
:100390001701B0911801309119010196A11DB11DED
:1003A000232F2D5F2D3720F02D570196A11DB11D54
:1003B000209319018093150190931601A0931701C2
:1003C000B09318018091110190911201A091130135
:1003D000B09114010196A11DB11D8093110190935C
:1003E0001201A0931301B0931401BF91AF919F919B
:1003F0008F913F912F910F900FBE0F901F901895E6
:10040000EF92FF920F931F937B018C018FB7F894AB
:1004100040911501509116016091170170911801DA
:100420008FBF2FB7F8948091150190911601A0917C
:100430001701B09118012FBF841B950BA60BB70BAA
:10044000E816F9060A071B0760F71F910F91FF9046
:10045000EF900895789484B5826084BD84B58160FE
:1004600084BD85B5826085BD85B5816085BDEEE6BC
:10047000F0E0808181608083E1E8F0E0808182604B
:100480008083808181608083E0E8F0E0808181600A
:100490008083E1EBF0E0808184608083E0EBF0E03A
:1004A000808181608083EAE7F0E0808184608083DE
:1004B0008081826080838081816080838081806888
:1004C00080831092C10008951F920F920FB60F9271
:1004D00011242F933F934F935F936F937F938F9349
:1004E0009F93AF93BF93EF93FF934091C600E0912A
:1004F0009A01F0919B01CF01019660E870E00E94A3
:1005000023059C0180919C0190919D01281739073A
:1005100039F0E65EFE4F408330939B0120939A01B1
:10052000FF91EF91BF91AF919F918F917F916F91CB
:100530005F914F913F912F910F900FBE0F901F90A1
:1005400018955F926F927F928F929F92AF92BF9217
:10055000CF92DF92EF92FF920F931F93CF93DF938F
:10056000EC013A014B01413482E458078FE06807FF
:1005700080E078070CF07FC060E874E88EE190E0DE
:10058000A40193010E945805215030404040504042
:10059000CA01B90122E030E040E050E00E94580575
:1005A00059016A01A6019501209530954095509515
:1005B00094E0220F331F441F551F9A95D1F760E036
:1005C00074E284EF90E00E945805CA01B9012FEF50
:1005D00030E040E050E00E940405A40193010E9435
:1005E0005805C90181509F4F181619061CF4522E48
:1005F0005A9403C055245394521A60E079E08DE375
:1006000090E0A40193010E945805215030404040E1
:100610005040CA01B90122E030E040E050E00E94C1
:100620005805209530954095509583E0220F331F53
:10063000441F551F8A95D1F760E074E284EF90E083
:100640000E945805CA01B9012FEF30E040E050E0A8
:100650000E940405A40193010E945805C90181501C
:100660009F4F181619061CF4822F815002C081E09A
:10067000821B851500F5E885F98581E090E00A8800
:1006800002C0880F991F0A94E2F7808360E079E046
:100690008DE390E0A40193010E9458052150304061
:1006A00040405040CA01B90122E030E040E050E053
:1006B0000E94580504C0E885F98510829501EC81F7
:1006C000FD813083EE81FF812083EA85FB852081D7
:1006D00041E050E0CA010E8402C0880F991F0A94BD
:1006E000E2F7282B2083EA85FB852081CA010F844D
:1006F00002C0880F991F0A94E2F7282B2083EA850D
:10070000FB858081088802C0440F551F0A94E2F7D8
:10071000842B8083DF91CF911F910F91FF90EF90F9
:10072000DF90CF90BF90AF909F908F907F906F9011
:100730005F900895FC01A085B18521898C9190E09E
:10074000022E02C0959587950A94E2F780FFF6CFB6
:100750000484F585E02D6083089588E091E090930E
:100760009F0180939E018AE191E09093A101809383
:10077000A00185EC90E09093A3018093A20184EC0A
:1007800090E09093A5018093A40180EC90E0909379
:10079000A7018093A60181EC90E09093A90180933A
:1007A000A80186EC90E09093AB018093AA0184E0CD
:1007B0008093AC0183E08093AD0187E08093AE012C
:1007C00085E08093AF0181E08093B00108950F939D
:1007D0001F93CF93DF938C01EB0109C02196D801C1
:1007E000ED91FC910190F081E02DC801099568819F
:1007F0006623A1F7DF91CF911F910F910895EF929A
:10080000FF920F931F93CF93DF938C017B01EA013B
:100810000CC0D7016D917D01D801ED91FC91019043
:10082000F081E02DC80109952197209791F7DF917C
:10083000CF911F910F91FF90EF9008950F931F9309
:100840008C01DC01ED91FC910190F081E02D6DE0D7
:100850000995D801ED91FC910190F081E02DC8013E
:100860006AE009951F910F9108952F923F924F9240
:100870005F926F927F928F929F92AF92BF92CF9230
:10088000DF92EF92FF920F931F93DF93CF93CDB739
:10089000DEB7A0970FB6F894DEBF0FBECDBF1C0128
:1008A0006A017B01411551056105710549F4DC01BF
:1008B000ED91FC910190F081E02D60E3099554C029
:1008C000882499245401422E55246624772401E07B
:1008D00010E00C0F1D1F080D191DC701B601A30163
:1008E00092010E943605F80160830894811C911CD6
:1008F000A11CB11CC701B601A30192010E943605DB
:10090000C901DA016C017D01C114D104E104F104D3
:10091000F1F681E0E82EF12CEC0EFD1EE80CF91C3E
:100920003E010894611C711CD501C4010197A10905
:10093000B1096C01C818D90814C0F601EE0DFF1DED
:1009400060816A3010F4605D01C0695CD101ED9195
:10095000FC910190F081E02DC10109950894E10816
:10096000F1086E147F0449F7A0960FB6F894DEBF25
:100970000FBECDBFCF91DF911F910F91FF90EF90F0
:10098000DF90CF90BF90AF909F908F907F906F90AF
:100990005F904F903F902F900895EF92FF920F93AA
:1009A0001F93CF93DF93EC017A018B0177FF0FC088
:1009B000E881F9810190F081E02D6DE209951095B3
:1009C0000095F094E094E11CF11C011D111DCE0175
:1009D000B801A7012AE00E943504DF91CF911F9151
:1009E0000F91FF90EF9008950F931F938C01AB012F
:1009F000662757FD6095762F0E94CD04C8010E949E
:100A00001E041F910F910895629FD001739FF00102
:100A1000829FE00DF11D649FE00DF11D929FF00D8E
:100A2000839FF00D749FF00D659FF00D9927729FC5
:100A3000B00DE11DF91F639FB00DE11DF91FBD0150
:100A4000CF011124089597FB092E07260AD077FDC0
:100A500004D049D006D000201AF4709561957F4FDC
:100A60000895F6F7909581959F4F0895A1E21A2E6B
:100A7000AA1BBB1BFD010DC0AA1FBB1FEE1FFF1F42
:100A8000A217B307E407F50720F0A21BB30BE40B92
:100A9000F50B661F771F881F991F1A9469F76095D9
:100AA0007095809590959B01AC01BD01CF01089593
:100AB00097FB092E05260ED057FD04D0D7DF0AD0AC
:100AC000001C38F450954095309521953F4F4F4F7D
:100AD0005F4F0895F6F790958095709561957F4FDB
:100AE0008F4F9F4F0895AA1BBB1B51E107C0AA1F40
:100AF000BB1FA617B70710F0A61BB70B881F991FBF
:100B00005A95A9F780959095BC01CD010895EE0FF7
:0E0B1000FF1F0590F491E02D0994F894FFCF9B
:0E0B1E000B000C00000000009A03E703FF0329
:00000001FF

@ -0,0 +1,65 @@
#include <avr/interrupt.h>
#include <avr/io.h>
int pinA = 11;
int pinB = 12;
int ledPin = 13;
void setup() {
//Timer2 Settings
TCCR2A = 0;
TCCR2B = 0<<CS22 | 1<<CS21 | 0<<CS20;
//Timer2 Overflow Interrupt Enable
TIMSK2 = 1<<TOIE2;
// pullups
digitalWrite(pinA, HIGH);
digitalWrite(pinB, HIGH);
Serial.begin(9600);
}
volatile int8_t enc_delta; // -128 ... 127
static int8_t last;
ISR(TIMER2_OVF_vect) {
int8_t neu, diff;
// convert gray to binary
neu = 0;
if(digitalRead(pinA))
neu = 3;
if(digitalRead(pinB))
neu ^= 1;
diff = last - neu; // difference last - new
if( diff & 1 ) { // bit 0 = value (1)
last = neu; // store new as next last
enc_delta += (diff & 2) - 1; // bit 1 = direction (+/-)
}
}
int8_t val_alt;
void loop() {
int8_t val;
digitalWrite(13,HIGH);
cli();
val = enc_delta;
// enc_delta = val & 1;
sei();
if (val != val_alt) {
Serial.println(val>>1);
}
val_alt = val;
delay(100);
digitalWrite(13,LOW);
delay(100);
}

@ -0,0 +1,63 @@
#include "WProgram.h"
void setup();
void loop();
int pinA = 11;
int pinB = 12;
int pinLED = 13;
void setup() {
Serial.begin(9600);
pinMode(pinA, INPUT);
digitalWrite(pinA, HIGH);
pinMode(pinB, INPUT);
digitalWrite(pinB, HIGH);
pinMode(pinLED, OUTPUT);
}
int a_old, b_old, dreh;
void loop() {
// shall we blink
// if (millis() - prevMillis > 100) {
// prevMillis = millis();
//
// if (pinLEDstate == LOW)
// pinLEDstate = HIGH;
// else
// pinLEDstate = LOW;
// digitalWrite(pinLED, pinLEDstate);
//
int a = digitalRead(pinA);
int b = digitalRead(pinB);
if (a != a_old || b != b_old) {
Serial.print(digitalRead(pinA));
Serial.print(" ");
Serial.print(digitalRead(pinB));
Serial.println();
dreh++;
// Serial.println("C:> _");
}
digitalWrite(pinLED, a);
a_old = a;
b_old = b;
}
int main(void)
{
init();
setup();
for (;;)
loop();
return 0;
}

@ -0,0 +1,178 @@
:100000000C9462000C948A000C948A000C948A0070
:100010000C948A000C948A000C948A000C948A0038
:100020000C948A000C948A000C948A000C948A0028
:100030000C948A000C948A000C948A000C948A0018
:100040000C94C4010C948A000C9446020C948A000F
:100050000C948A000C948A000C948A000C948A00F8
:100060000C948A000C948A000000000024002700F1
:100070002A0000000000250028002B0000000000DE
:1000800023002600290004040404040404040202DA
:100090000202020203030303030301020408102007
:1000A0004080010204081020010204081020000012
:1000B0000007000201000003040600000000000029
:1000C00000008F0311241FBECFEFD4E0DEBFCDBFF1
:1000D00011E0A0E0B1E0E2EEFAE002C005900D927E
:1000E000A231B107D9F711E0A2E1B1E001C01D9240
:1000F000A83BB107E1F710E0C4ECD0E004C02297C0
:10010000FE010E946B05C23CD107C9F70E940101A4
:100110000C946F050C9400000F931F93CF93DF9303
:10012000809102010E947501EC01809104010E94FE
:1001300075018C018091120190911301C817D907A4
:1001400039F480911401909115010817190729F1CC
:10015000809102010E947501BC0185EA91E00E9434
:10016000DE0485EA91E060E071E00E940004809185
:1001700004010E947501BC0185EA91E00E94DE0441
:1001800085EA91E00E940804809116019091170180
:1001900001969093170180931601809106016C2FB0
:1001A0000E942801D0931301C093120110931501EE
:1001B00000931401DF91CF911F910F91089585EA6B
:1001C00091E040E855E260E070E00E948302809197
:1001D000020160E00E9408018091020161E00E943A
:1001E00028018091040160E00E94080180910401CF
:1001F00061E00E9428018091060161E00E940801EF
:1002000008950E940C020E94DF000E948C00FDCF26
:10021000282F30E0C90186569F4FFC0194912A5740
:100220003F4FF9018491882391F0E82FF0E0EE0F21
:10023000FF1FE859FF4FA591B491662329F48C91D3
:10024000909589238C9308958C91892B8C93089594
:10025000482F50E0CA0182559F4FFC012491CA01EA
:1002600086569F4FFC0194914A575F4FFA01349193
:100270003323D1F1222331F1233021F48091800006
:100280008F7705C0243031F4809180008F7D80937A
:10029000800018C0213019F484B58F7704C0223053
:1002A00021F484B58F7D84BD0DC0263021F480916A
:1002B000B0008F7705C0273029F48091B0008F7D82
:1002C0008093B000E32FF0E0EE0FFF1FEE58FF4FDA
:1002D000A591B491662329F48C91909589238C93F0
:1002E00008958C91892B8C930895682F70E0CB0131
:1002F00082559F4FFC012491CB0186569F4FFC01F4
:1003000044916A577F4FFB019491992319F420E09F
:1003100030E038C0222331F1233021F48091800075
:100320008F7705C0243031F4809180008F7D8093D9
:10033000800018C0213019F484B58F7704C02230B2
:1003400021F484B58F7D84BD0DC0263021F48091C9
:10035000B0008F7705C0273029F48091B0008F7DE1
:100360008093B000892F90E0880F991F84589F4F89
:10037000FC01A591B4918C9120E030E0842311F030
:1003800021E030E0C90108951F920F920FB60F923D
:1003900011242F933F938F939F93AF93BF9380919B
:1003A0001C0190911D01A0911E01B0911F0130917F
:1003B00020010196A11DB11D232F2D5F2D3720F0A7
:1003C0002D570196A11DB11D2093200180931C0182
:1003D00090931D01A0931E01B0931F0180911801FD
:1003E00090911901A0911A01B0911B010196A11DD4
:1003F000B11D8093180190931901A0931A01B09335
:100400001B01BF91AF919F918F913F912F910F90C1
:100410000FBE0F901F901895789484B5826084BDAC
:1004200084B5816084BD85B5826085BD85B58160F8
:1004300085BDEEE6F0E0808181608083E1E8F0E058
:10044000808182608083808181608083E0E8F0E049
:10045000808181608083E1EBF0E080818460808333
:10046000E0EBF0E0808181608083EAE7F0E080816A
:1004700084608083808182608083808181608083CA
:100480008081806880831092C10008951F920F922E
:100490000FB60F9211242F933F934F935F936F9357
:1004A0007F938F939F93AF93BF93EF93FF9340916D
:1004B000C600E091A101F091A201CF01019660E890
:1004C00070E00E9405059C018091A3019091A40118
:1004D0002817390739F0EF5DFE4F40833093A201B2
:1004E0002093A101FF91EF91BF91AF919F918F91C7
:1004F0007F916F915F914F913F912F910F900FBE20
:100500000F901F9018955F926F927F928F929F929B
:10051000AF92BF92CF92DF92EF92FF920F931F9311
:10052000CF93DF93EC013A014B01413482E4580749
:100530008FE0680780E078070CF07FC060E874E81F
:100540008EE190E0A40193010E943A0521503040D1
:1005500040405040CA01B90122E030E040E050E0A4
:100560000E943A0559016A01A6019501209530952E
:100570004095509594E0220F331F441F551F9A95C4
:10058000D1F760E074E284EF90E00E943A05CA017E
:10059000B9012FEF30E040E050E00E94E604A401F2
:1005A00093010E943A05C90181509F4F1816190600
:1005B0001CF4522E5A9403C055245394521A60E0EE
:1005C00079E08DE390E0A40193010E943A05215067
:1005D000304040405040CA01B90122E030E040E0E4
:1005E00050E00E943A05209530954095509583E063
:1005F000220F331F441F551F8A95D1F760E074E224
:1006000084EF90E00E943A05CA01B9012FEF30E073
:1006100040E050E00E94E604A40193010E943A05E4
:10062000C90181509F4F181619061CF4822F815062
:1006300002C081E0821B851500F5E885F98581E01F
:1006400090E00A8802C0880F991F0A94E2F780831D
:1006500060E079E08DE390E0A40193010E943A0507
:100660002150304040405040CA01B90122E030E002
:1006700040E050E00E943A0504C0E885F985108208
:100680009501EC81FD813083EE81FF812083EA8535
:10069000FB85208141E050E0CA010E8402C0880F32
:1006A000991F0A94E2F7282B2083EA85FB85208195
:1006B000CA010F8402C0880F991F0A94E2F7282B01
:1006C0002083EA85FB858081088802C0440F551F7E
:1006D0000A94E2F7842B8083DF91CF911F910F91D1
:1006E000FF90EF90DF90CF90BF90AF909F908F9052
:1006F0007F906F905F900895FC01A085B18521895E
:100700008C9190E0022E02C0959587950A94E2F7AD
:1007100080FFF6CF0484F585E02D608308958CE09A
:1007200091E09093A6018093A50181E291E09093DE
:10073000A8018093A70185EC90E09093AA01809393
:10074000A90184EC90E09093AC018093AB0180EC24
:1007500090E09093AE018093AD0181EC90E0909396
:10076000B0018093AF0186EC90E09093B20180934A
:10077000B10184E08093B30183E08093B40187E00A
:100780008093B50185E08093B60181E08093B70145
:1007900008950F931F93CF93DF938C01EB0109C052
:1007A0002196D801ED91FC910190F081E02DC801D6
:1007B000099568816623A1F7DF91CF911F910F9171
:1007C0000895EF92FF920F931F93CF93DF938C01C5
:1007D0007B01EA010CC0D7016D917D01D801ED913B
:1007E000FC910190F081E02DC80109952197209797
:1007F00091F7DF91CF911F910F91FF90EF900895A6
:10080000DC01ED91FC910280F381E02D09950895C2
:100810000F931F938C01DC01ED91FC910190F0810D
:10082000E02D6DE00995D801ED91FC910190F081EA
:10083000E02DC8016AE009951F910F9108952F924C
:100840003F924F925F926F927F928F929F92AF9260
:10085000BF92CF92DF92EF92FF920F931F93DF939D
:10086000CF93CDB7DEB7A0970FB6F894DEBF0FBE1B
:10087000CDBF1C016A017B01411551056105710560
:1008800049F4DC01ED91FC910190F081E02D60E3F1
:10089000099554C0882499245401422E5524662475
:1008A000772401E010E00C0F1D1F080D191DC70172
:1008B000B601A30192010E941805F8016083089413
:1008C000811C911CA11CB11CC701B601A30192019E
:1008D0000E941805C901DA016C017D01C114D1041F
:1008E000E104F104F1F681E0E82EF12CEC0EFD1E9E
:1008F000E80CF91C3E010894611C711CD501C4016F
:100900000197A109B1096C01C818D90814C0F601F2
:10091000EE0DFF1D60816A3010F4605D01C0695CFE
:10092000D101ED91FC910190F081E02DC10109957B
:100930000894E108F1086E147F0449F7A0960FB6F9
:10094000F894DEBF0FBECDBFCF91DF911F910F9105
:10095000FF90EF90DF90CF90BF90AF909F908F90DF
:100960007F906F905F904F903F902F900895EF92FF
:10097000FF920F931F93CF93DF93EC017A018B01CA
:1009800077FF0FC0E881F9810190F081E02D6DE2E1
:10099000099510950095F094E094E11CF11C011D5F
:1009A000111DCE01B801A7012AE00E941F04DF91AA
:1009B000CF911F910F91FF90EF900895AB016627A3
:1009C00057FD6095762F0E94B7040895629FD0016D
:1009D000739FF001829FE00DF11D649FE00DF11DFA
:1009E000929FF00D839FF00D749FF00D659FF00DA9
:1009F0009927729FB00DE11DF91F639FB00DE11D96
:100A0000F91FBD01CF011124089597FB092E072678
:100A10000AD077FD04D049D006D000201AF4709592
:100A200061957F4F0895F6F7909581959F4F0895B2
:100A3000A1E21A2EAA1BBB1BFD010DC0AA1FBB1FE2
:100A4000EE1FFF1FA217B307E407F50720F0A21B54
:100A5000B30BE40BF50B661F771F881F991F1A94C1
:100A600069F760957095809590959B01AC01BD01EB
:100A7000CF01089597FB092E05260ED057FD04D00F
:100A8000D7DF0AD0001C38F4509540953095219559
:100A90003F4F4F4F5F4F0895F6F7909580957095B3
:100AA00061957F4F8F4F9F4F0895AA1BBB1B51E14C
:100AB00007C0AA1FBB1FA617B70710F0A61BB70BCE
:100AC000881F991F5A95A9F780959095BC01CD0173
:100AD0000895EE0FFF1F0590F491E02D0994F8940E
:020AE000FFCF46
:100AE20020000B000C000D00000000007C03C90375
:020AF200E1031E
:00000001FF

@ -0,0 +1,47 @@
int pinA = 11;
int pinB = 12;
int pinLED = 13;
void setup() {
Serial.begin(9600);
pinMode(pinA, INPUT);
digitalWrite(pinA, HIGH);
pinMode(pinB, INPUT);
digitalWrite(pinB, HIGH);
pinMode(pinLED, OUTPUT);
}
int a_old, b_old, dreh;
void loop() {
// shall we blink
// if (millis() - prevMillis > 100) {
// prevMillis = millis();
//
// if (pinLEDstate == LOW)
// pinLEDstate = HIGH;
// else
// pinLEDstate = LOW;
// digitalWrite(pinLED, pinLEDstate);
//
int a = digitalRead(pinA);
int b = digitalRead(pinB);
if (a != a_old || b != b_old) {
Serial.print(digitalRead(pinA));
Serial.print(" ");
Serial.print(digitalRead(pinB));
Serial.println();
dreh++;
// Serial.println("C:> _");
}
digitalWrite(pinLED, a);
a_old = a;
b_old = b;
}

@ -0,0 +1,54 @@
#include <LCD4Bit.h>
#include "WProgram.h"
void setup();
void loop();
LCD4Bit lcd = LCD4Bit(2);
void setup() {
lcd.init();
lcd.clear();
lcd.printIn("World Arduinination in progress...");
}
int i = 0,j = 0, dir = 1;
char bfr[4];
void loop() {
digitalWrite(13, HIGH);
lcd.cursorTo(2, 0);
itoa(i, bfr, 10);
lcd.printIn(bfr);
lcd.printIn("%");
lcd.cursorTo(2, 4);
for(j=0; j < (i / 3); j++)
lcd.print(255);
for(j=i/3; j < 100/3; j++)
lcd.printIn(" ");
if(i >= 98)
dir = -1;
if(dir == -1 && i <= 80)
dir = 1;
i += dir;
digitalWrite(13,LOW);
delay(100);
}
int main(void)
{
init();
setup();
for (;;)
loop();
return 0;
}

@ -0,0 +1,151 @@
:100000000C9462000C948A000C948A000C948A0070
:100010000C948A000C948A000C948A000C948A0038
:100020000C948A000C948A000C948A000C948A0028
:100030000C948A000C948A000C948A000C948A0018
:100040000C94A3030C948A000C948A000C948A00EC
:100050000C948A000C948A000C948A000C948A00F8
:100060000C948A000C948A000000000024002700F1
:100070002A0000000000250028002B0000000000DE
:1000800023002600290004040404040404040202DA
:100090000202020203030303030301020408102007
:1000A0004080010204081020010204081020000012
:1000B0000007000201000003040600000000000029
:1000C00000007D0211241FBECFEFD4E0DEBFCDBF04
:1000D00011E0A0E0B1E0E8E1F9E002C005900D9286
:1000E000AA33B107D9F711E0AAE3B1E001C01D922C
:1000F000AE34B107E1F710E0C4ECD0E004C02297C1
:10010000FE010E948604C23CD107C9F70E942F035A
:100110000C948A040C940000FB019F01E894423087
:10012000C4F04532B4F44A3029F497FB1EF490959C
:1001300081959F4F642F77270E947004805D8A33DA
:100140000CF0895D8193CB010097A1F716F45DE275
:1001500051931082C9010C94AD00DC01FC01672FA2
:1001600071917723E1F7329704C07C916D9370838E
:100170006291AE17BF07C8F308957093360160937C
:100180003501615070406230710530F081E090E0DF
:100190009093360180933501089580912B0160E0A2
:1001A0000E94560381E090E00E94150480912B018B
:1001B00061E00E94560381E090E00E941504809166
:1001C0002B0160E00E94560361E070E080E090E067
:1001D0000E94EB030895EF92FF920F931F93CF932A
:1001E000DF937C018B010F701070C0912D01D091B5
:1001F0002E0108C0602F61708C2F0E945603159548
:100200000795219680913301909134018C179D07B9
:100210008CF7C7010E94CD00DF91CF911F910F9104
:10022000FF90EF900895EF92FF920F931F938C0130
:100230007B0194E0759567959A95E1F7C8010E9456
:10024000EB008FE0E822FF24C801B7010E94EB0019
:100250001F910F91FF90EF9008950F931F93CF93ED
:10026000DF93EC018B018091270160E00E9456032F
:1002700080913A0190913B01892B29F080912901CD
:1002800060E00E945603CE01B8010E94EB00DF91AE
:10029000CF911F910F9108950F931F93CF93DF93E9
:1002A000EC018B018091270161E00E94560380914F
:1002B0003A0190913B01892B29F08091290160E05E
:1002C0000E945603CE01B8010E941301DF91CF9125
:1002D0001F910F910895CF92DF92FF920F931F937A
:1002E000CF93DF936C018B01FF240AC0C00FD11F95
:1002F0006881772767FD7095C6010E944C01F394D1
:10030000CF2DD0E0F80101900020E9F73197E01BF4
:10031000F10BCE17DF0750F3DF91CF911F910F91B3
:10032000FF90DF90CF9008950F931F93CF93DF93AB
:10033000EC018B018091270160E00E9456038091BF
:100340003A0190913B01892B29F08091290160E0CD
:100350000E945603CE01B8010E941301DF91CF9194
:100360001F910F910895EF92FF920F931F93CF93D8
:10037000DF937C01EB018A0162E070E00E9494014E
:1003800062E070E080E090E00E94EB038091350134
:1003900090913601019721F0229711F4085D1F4FCB
:1003A000C0E0D0E006C0C70164E170E00E949401A3
:1003B0002196C017D107BCF3DF91CF911F910F9108
:1003C000FF90EF900895CF93DF93EC0180912B0184
:1003D00061E00E9436038091270161E00E943603AC
:1003E00080913A0190913B01892B29F0809129015C
:1003F00061E00E94360380912D0161E00E94360386
:1004000080912F0161E00E9436038091310161E00B
:100410000E9436038091330161E00E94360362E35B
:1004200070E080E090E00E94EB03CE0163E070E0BA
:100430000E942D0165E070E080E090E00E94EB03F7
:10044000CE0163E070E00E942D0184E690E00E94FE
:100450001504CE0163E070E00E942D0165E070E0BC
:1004600080E090E00E94EB03CE0162E070E00E9429
:100470002D01CE0162E070E00E942D0160913501F6
:10048000709136016150704023E0660F771F2A9506
:10049000E1F7CE010E942D018CE390E00E9415044B
:1004A000CE016CE070E00E9494018CE390E00E9429
:1004B0001504CE0161E070E00E94940163E070E0F9
:1004C00080E090E00E94EB03CE0166E070E00E94C5
:1004D000940161E070E080E090E00E94EB03DF9126
:1004E000CF91089561E070E00E94940161E070E0B6
:1004F00080E090E00E94EB0308958CE391E062E0DD
:1005000070E00E94BD0008958DE061E00E945603F6
:100510008CE391E062E070E040E050E00E94B301C3
:1005200080913D0190913E0161E471E04AE050E02C
:100530000E948C008CE391E061E471E00E946B0109
:100540008CE391E060E071E00E946B018CE391E04C
:1005500062E070E044E050E00E94B301109240017C
:1005600010923F010FC08CE391E06FEF70E00E94AA
:100570004C0180913F019091400101969093400180
:1005800080933F0180913D0190913E0163E070E0D6
:100590000E945D0480913F0190914001861797076A
:1005A00014F37093400160933F010FC08CE391E01E
:1005B00062E071E00E946B0180913F0190914001E7
:1005C00001969093400180933F0180913F0190916B
:1005D000400181975CF320913D0130913E0122362C
:1005E000310534F08FEF9FEF9093380180933701FE
:1005F00080913701909138018F5F9F4F49F42135E9
:10060000310534F481E090E0909338018093370114
:100610008091370190913801820F931F90933E0192
:1006200080933D018DE060E00E94560364E670E037
:1006300080E090E00E94EB0308950F931F930CE37A
:1006400011E0C8010E94E301C8010E947202C801C2
:1006500064E071E00E946B011F910F9108950E9468
:1006600023040E941D030E948402FDCF282F30E046
:10067000C90186569F4FFC0194912A573F4FF901BB
:100680008491882391F0E82FF0E0EE0FFF1FE859E6
:10069000FF4FA591B491662329F48C9190958923FD
:1006A0008C9308958C91892B8C930895482F50E05A
:1006B000CA0182559F4FFC012491CA0186569F4F63
:1006C000FC0194914A575F4FFA0134913323D1F1E1
:1006D000222331F1233021F4809180008F7705C0EF
:1006E000243031F4809180008F7D8093800018C089
:1006F000213019F484B58F7704C0223021F484B5F9
:100700008F7D84BD0DC0263021F48091B0008F779D
:1007100005C0273029F48091B0008F7D8093B00010
:10072000E32FF0E0EE0FFF1FEE58FF4FA591B491BD
:10073000662329F48C91909589238C9308958C914C
:10074000892B8C9308951F920F920FB60F9211244C
:100750002F933F938F939F93AF93BF9380914901C2
:1007600090914A01A0914B01B0914C0130914D0103
:100770000196A11DB11D232F2D5F2D3720F02D5780
:100780000196A11DB11D20934D01809349019093C5
:100790004A01A0934B01B0934C0180914501909187
:1007A0004601A0914701B09148010196A11DB11DDC
:1007B0008093450190934601A0934701B09348016F
:1007C000BF91AF919F918F913F912F910F900FBE4D
:1007D0000F901F901895EF92FF920F931F937B013C
:1007E0008C018FB7F8944091490150914A01609172
:1007F0004B0170914C018FBF2FB7F8948091490144
:1008000090914A01A0914B01B0914C012FBF841BE4
:10081000950BA60BB70BE816F9060A071B0760F73E
:100820001F910F91FF90EF900895019759F0FC01EF
:10083000EE0FFF1FEE0FFF1F32978FB7F89431971F
:10084000F1F78FBF0895789484B5826084BD84B534
:10085000816084BD85B5826085BD85B5816085BDBB
:10086000EEE6F0E0808181608083E1E8F0E0808165
:1008700082608083808181608083E0E8F0E0808115
:1008800081608083E1EBF0E0808184608083E0EB35
:10089000F0E0808181608083EAE7F0E0808184601D
:1008A0008083808182608083808181608083808179
:1008B000806880831092C100089597FB092E072657
:1008C0000AD077FD04D00CD006D000201AF4709521
:1008D00061957F4F0895F6F7909581959F4F089504
:1008E000AA1BBB1B51E107C0AA1FBB1FA617B70756
:1008F00010F0A61BB70B881F991F5A95A9F7809572
:100900009095BC01CD010895EE0FFF1F0590F49165
:08091000E02D0994F894FFCFDB
:1009180025002000576F726C642041726475696EFF
:10092800696E6174696F6E20696E2070726F67728C
:100938006573732E2E2E0002007F0003000400054D
:0A0948000006000700020001000095
:00000001FF

@ -0,0 +1,38 @@
#include <LCD4Bit.h>
LCD4Bit lcd = LCD4Bit(2);
void setup() {
lcd.init();
lcd.clear();
lcd.printIn("World Arduinination in progress...");
}
int i = 0,j = 0, dir = 1;
char bfr[4];
void loop() {
digitalWrite(13, HIGH);
lcd.cursorTo(2, 0);
itoa(i, bfr, 10);
lcd.printIn(bfr);
lcd.printIn("%");
lcd.cursorTo(2, 4);
for(j=0; j < (i / 3); j++)
lcd.print(255);
for(j=i/3; j < 100/3; j++)
lcd.printIn(" ");
if(i >= 98)
dir = -1;
if(dir == -1 && i <= 80)
dir = 1;
i += dir;
digitalWrite(13,LOW);
delay(100);
}

@ -0,0 +1,43 @@
#include <LCD4Bit.h>
LCD4Bit lcd = LCD4Bit(2);
void setup() {
lcd.init();
lcd.clear();
// create char
lcd.commandWrite(0x40);
lcd.print(0b10001);
lcd.print(0b01010);
lcd.print(0b10101);
lcd.print(0b11111);
lcd.print(0b01110);
lcd.print(0b10001);
lcd.print(0b10001);
lcd.print(0b01010);
// back to normal
lcd.cursorTo(1,0);
for(uint8_t i = 0; i < 80; i++) {
lcd.print(0x00+(i&0x7));
}
}
void loop() {
digitalWrite(13, HIGH);
lcd.commandWrite(0x40+8*random(8));
uint8_t fnord = random(8);
for (uint8_t i = 0; i<8; i++) {
if(i == fnord) {
lcd.print(0b11111);
} else {
lcd.print(0b00000);
}
}
digitalWrite(13,LOW);
delay(10);
}

@ -0,0 +1,47 @@
#include "WProgram.h"
void setup();
void loop();
int ledPin = 11;
int foo = 0;
int dir = 1;
int fnord = 0;
int loga[32] = {0, 1, 2, 2, 2, 3, 3, 4, 5, 6, 7, 8, 10, 11,
13, 16, 19, 23, 27, 32, 38, 45, 54, 64, 76,
91, 108, 128, 152, 181, 215, 255};
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(7, INPUT);
}
void loop() {
analogWrite(ledPin, loga[foo]);
fnord = digitalRead(7);
delay(100);
if (fnord) {
foo += dir;
}
if (foo >= 31) {
dir = -1;
}
if (foo <= 0) {
dir = +1;
}
}
int main(void)
{
init();
setup();
for (;;)
loop();
return 0;
}

@ -0,0 +1,90 @@
:100000000C9461000C947E000C947E000C947E0095
:100010000C947E000C947E000C947E000C947E0068
:100020000C947E000C947E000C947E000C947E0058
:100030000C947E000C947E000C947E000C947E0048
:100040000C94EC010C947E000C947E000C947E00C9
:100050000C947E000C947E000C947E000C947E0028
:100060000C947E000C947E00000000002400270009
:100070002A0000000000250028002B0000000000DE
:1000800023002600290004040404040404040202DA
:100090000202020203030303030301020408102007
:1000A0004080010204081020010204081020000012
:1000B0000007000201000003040600000000000029
:1000C000000011241FBECFEFD4E0DEBFCDBF11E092
:1000D000A0E0B1E0E4E3F5E002C005900D92A434A5
:1000E000B107D9F711E0A4E4B1E001C01D92A13538
:1000F000B107E1F70E94D0000C9498020C94000024
:10010000E0914401F0914501EE0FFF1FEC5FFE4FBF
:1001100060817181809100010E94930187E00E94BB
:100120004401909347018093460164E670E080E0CB
:1001300090E00E9434028091460190914701892B02
:1001400071F080914401909145012091020130911C
:100150000301820F931F90934501809344012091E6
:100160004401309145012F31310534F08FEF9FEF7D
:1001700090930301809302011216130634F081E07C
:1001800090E0909303018093020108958091000113
:1001900061E00E94D70087E060E00E94D7000895E8
:1001A0000E945E020E94C6000E948000FDCF282FA0
:1001B00030E0C90186569F4FFC0194912A573F4F6A
:1001C000F9018491882391F0E82FF0E0EE0FFF1FF2
:1001D000E859FF4FA591B491662329F48C9190952D
:1001E00089238C9308958C91892B8C930895482FA3
:1001F00050E0CA0182559F4FFC012491CA018656E6
:100200009F4FFC0194914A575F4FFA013491332379
:10021000D1F1222331F1233021F4809180008F77B6
:1002200005C0243031F4809180008F7D8093800060
:1002300018C0213019F484B58F7704C0223021F41E
:1002400084B58F7D84BD0DC0263021F48091B0002F
:100250008F7705C0273029F48091B0008F7D80937F
:10026000B000E32FF0E0EE0FFF1FEE58FF4FA59117
:10027000B491662329F48C91909589238C930895E9
:100280008C91892B8C930895682F70E0CB01825557
:100290009F4FFC012491CB0186569F4FFC01449156
:1002A0006A577F4FFB019491992319F420E030E0C5
:1002B00038C0222331F1233021F4809180008F77E0
:1002C00005C0243031F4809180008F7D80938000C0
:1002D00018C0213019F484B58F7704C0223021F47E
:1002E00084B58F7D84BD0DC0263021F48091B0008F
:1002F0008F7705C0273029F48091B0008F7D8093DF
:10030000B000892F90E0880F991F84589F4FFC01FF
:10031000A591B4918C9120E030E0842311F021E08C
:1003200030E0C90108951F93CF93DF93182FEB019D
:1003300061E00E94D700E12FF0E0E255FF4F849189
:10034000833051F480918000806880938000D09346
:100350008900C09388003CC0843051F480918000B3
:10036000806280938000D0938B00C0938A0030C05D
:10037000813039F4209729F184B5806884BDC7BDE8
:1003800027C0823039F42097E1F084B5806284BDC3
:10039000C8BD1EC0863041F48091B0008068809353
:1003A000B000C093B30014C0873041F48091B00016
:1003B00080628093B000C093B4000AC0C038D105F9
:1003C0001CF4812F60E002C0812F61E00E94F700E1
:1003D000DF91CF911F9108951F920F920FB60F9248
:1003E00011242F933F938F939F93AF93BF9380914B
:1003F0004C0190914D01A0914E01B0914F0130916F
:1004000050010196A11DB11D232F2D5F2D3720F026
:100410002D570196A11DB11D2093500180934C01D1
:1004200090934D01A0934E01B0934F0180914801EC
:1004300090914901A0914A01B0914B010196A11DF3
:10044000B11D8093480190934901A0934A01B09354
:100450004B01BF91AF919F918F913F912F910F9041
:100460000FBE0F901F901895EF92FF920F931F935E
:100470007B018C018FB7F89440914C0150914D0154
:1004800060914E0170914F018FBF2FB7F89480910A
:100490004C0190914D01A0914E01B0914F012FBFA1
:1004A000841B950BA60BB70BE816F9060A071B076A
:1004B00060F71F910F91FF90EF900895789484B5A5
:1004C000826084BD84B5816084BD85B5826085BD50
:1004D00085B5816085BDEEE6F0E080818160808336
:1004E000E1E8F0E0808182608083808181608083A8
:1004F000E0E8F0E0808181608083E1EBF0E08081E2
:1005000084608083E0EBF0E0808181608083EAE7B3
:10051000F0E080818460808380818260808380813C
:10052000816080838081806880831092C1000895FB
:04053000F894FFCF6D
:100534000B000100000001000200020002000300A1
:100544000300040005000600070008000A000B0071
:100554000D001000130017001B00200026002D00C2
:10056400360040004C005B006C0080009800B50031
:04057400D700FF00AD
:00000001FF

@ -0,0 +1,26 @@
int ledPin = 11;
int foo = 0;
int dir = 1;
int loga[32] = {0, 1, 2, 2, 2, 3, 3, 4, 5, 6, 7, 8, 10, 11,
13, 16, 19, 23, 27, 32, 38, 45, 54, 64, 76,
91, 108, 128, 152, 181, 215, 255};
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
analogWrite(ledPin, loga[foo]);
delay(100);
foo += dir;
if (foo >= 31) {
dir = -1;
}
if (foo <= 0) {
dir = +1;
}
}

Some files were not shown because too many files have changed in this diff Show More