Skip to content

Commit 090358a

Browse files
committed
Tested for ATtiny85
1 parent 2ccae65 commit 090358a

File tree

22 files changed

+96
-1127
lines changed

22 files changed

+96
-1127
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ If you do not know which protocol your IR transmitter uses, you have several cho
8181
the old [IRLib](https://github.com/cyborg5/IRLib) and [Infrared4Arduino](https://github.com/bengtmartensson/Infrared4Arduino).
8282
- To **increase strength of sent output signal** you can increase the current through the send diode, and/or use 2 diodes in series,
8383
since one IR diode requires only 1.5 volt.
84+
- The default software generated PWM has problems on ATtinies running with 8 MHz. The PWM frequency is around 30 instead of 38 kHz and RC6 is not reliable.
8485

8586
# Examples
8687
### SimpleReceiver + SimpleSender

examples/ControlRelay/PinDefinitionsAndMore.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@
6969
#define IR_TIMING_TEST_PIN PA5
7070

7171
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
72-
//#include "ATtinySerialOut.h"
7372
# if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
74-
# if defined(ARDUINO_AVR_DIGISPARK)
73+
# if defined(ARDUINO_AVR_DIGISPARK) // tested with 16 and 8 MHz
74+
//#include "ATtinySerialOut.h" // saves 370 bytes program space and 38 bytes RAM
7575
#define LED_BUILTIN PB1
7676
# endif
7777
#define IR_RECEIVE_PIN 0
7878
#define IR_SEND_PIN 4 // Pin 2 is serial output with ATtinySerialOut. Pin 1 is internal LED and Pin3 is USB+ with pullup on Digispark board.
7979
#define TONE_PIN 3
80-
//#define IR_TIMING_TEST_PIN 3
80+
#define IR_TIMING_TEST_PIN 3
8181

8282
# else
8383
// ATtiny87 + ATtiny167 here. For ATtiny167 Pins PB6 and PA3 are usable as interrupt source.

examples/ReceiveAndSend/PinDefinitionsAndMore.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@
6969
#define IR_TIMING_TEST_PIN PA5
7070

7171
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
72-
//#include "ATtinySerialOut.h"
7372
# if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
74-
# if defined(ARDUINO_AVR_DIGISPARK)
73+
# if defined(ARDUINO_AVR_DIGISPARK) // tested with 16 and 8 MHz
74+
//#include "ATtinySerialOut.h" // saves 370 bytes program space and 38 bytes RAM
7575
#define LED_BUILTIN PB1
7676
# endif
7777
#define IR_RECEIVE_PIN 0
7878
#define IR_SEND_PIN 4 // Pin 2 is serial output with ATtinySerialOut. Pin 1 is internal LED and Pin3 is USB+ with pullup on Digispark board.
7979
#define TONE_PIN 3
80-
//#define IR_TIMING_TEST_PIN 3
80+
#define IR_TIMING_TEST_PIN 3
8181

8282
# else
8383
// ATtiny87 + ATtiny167 here. For ATtiny167 Pins PB6 and PA3 are usable as interrupt source.

examples/ReceiveDemo/PinDefinitionsAndMore.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@
6969
#define IR_TIMING_TEST_PIN PA5
7070

7171
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
72-
//#include "ATtinySerialOut.h"
7372
# if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
74-
# if defined(ARDUINO_AVR_DIGISPARK)
73+
# if defined(ARDUINO_AVR_DIGISPARK) // tested with 16 and 8 MHz
74+
//#include "ATtinySerialOut.h" // saves 370 bytes program space and 38 bytes RAM
7575
#define LED_BUILTIN PB1
7676
# endif
7777
#define IR_RECEIVE_PIN 0
7878
#define IR_SEND_PIN 4 // Pin 2 is serial output with ATtinySerialOut. Pin 1 is internal LED and Pin3 is USB+ with pullup on Digispark board.
7979
#define TONE_PIN 3
80-
//#define IR_TIMING_TEST_PIN 3
80+
#define IR_TIMING_TEST_PIN 3
8181

8282
# else
8383
// ATtiny87 + ATtiny167 here. For ATtiny167 Pins PB6 and PA3 are usable as interrupt source.

examples/ReceiveDemo/ReceiveDemo.ino

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* ReceiveDemo.cpp
33
*
44
* Demonstrates receiving IR codes with the IRremote library.
5+
* If debug button is pressed (pin connected to ground) a long output is generated.
56
*
67
* This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
78
*
@@ -39,13 +40,13 @@
3940
//#define DECODE_LG 1
4041
//#define DECODE_NEC 1
4142
// etc. see IRremote.h
42-
43+
//
4344
//#define DISABLE_LED_FEEDBACK_FOR_RECEIVE // saves 108 bytes program space
44-
45-
#if defined(__AVR_ATtiny85__)
45+
#if FLASHEND > 0x1FFF
4646
#define EXCLUDE_EXOTIC_PROTOCOLS
4747
#endif
4848
//#define EXCLUDE_EXOTIC_PROTOCOLS // saves around 670 bytes program space if all protocols are active
49+
//#define IR_MEASURE_TIMING
4950

5051
// MARK_EXCESS_MICROS is subtracted from all marks and added to all spaces before decoding,
5152
// to compensate for the signal forming of different IR receiver modules.
@@ -59,7 +60,7 @@
5960
#include <IRremote.h>
6061

6162
#if defined(APPLICATION_PIN)
62-
#define DEBUG_BUTTON_PIN APPLICATION_PIN // if held low, print timing for each received data
63+
#define DEBUG_BUTTON_PIN APPLICATION_PIN // if low, print timing for each received data set
6364
#else
6465
#define DEBUG_BUTTON_PIN 6
6566
#endif
@@ -70,7 +71,10 @@
7071
#endif
7172

7273
void setup() {
73-
#if !defined(__AVR_ATtiny85__)
74+
#if defined(IR_MEASURE_TIMING) && defined(IR_TIMING_TEST_PIN)
75+
pinMode(IR_TIMING_TEST_PIN, OUTPUT);
76+
#endif
77+
#if FLASHEND > 0x1FFF
7478
pinMode(DEBUG_BUTTON_PIN, INPUT_PULLUP);
7579
#endif
7680

@@ -93,6 +97,11 @@ void setup() {
9397
Serial.print(F("Ready to receive IR signals at pin "));
9498
Serial.println(IR_RECEIVE_PIN);
9599

100+
#if FLASHEND > 0x1FFF
101+
Serial.print(F("Debug button pin is "));
102+
Serial.println(DEBUG_BUTTON_PIN);
103+
#endif
104+
96105
// infos for receive
97106
Serial.print(MARK_EXCESS_MICROS);
98107
Serial.println(F(" us are subtracted from all marks and added to all spaces for decoding"));

examples/ReceiveDump/PinDefinitionsAndMore.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@
6969
#define IR_TIMING_TEST_PIN PA5
7070

7171
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
72-
//#include "ATtinySerialOut.h"
7372
# if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
74-
# if defined(ARDUINO_AVR_DIGISPARK)
73+
# if defined(ARDUINO_AVR_DIGISPARK) // tested with 16 and 8 MHz
74+
//#include "ATtinySerialOut.h" // saves 370 bytes program space and 38 bytes RAM
7575
#define LED_BUILTIN PB1
7676
# endif
7777
#define IR_RECEIVE_PIN 0
7878
#define IR_SEND_PIN 4 // Pin 2 is serial output with ATtinySerialOut. Pin 1 is internal LED and Pin3 is USB+ with pullup on Digispark board.
7979
#define TONE_PIN 3
80-
//#define IR_TIMING_TEST_PIN 3
80+
#define IR_TIMING_TEST_PIN 3
8181

8282
# else
8383
// ATtiny87 + ATtiny167 here. For ATtiny167 Pins PB6 and PA3 are usable as interrupt source.

examples/SendBoseWaveDemo/PinDefinitionsAndMore.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@
6969
#define IR_TIMING_TEST_PIN PA5
7070

7171
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
72-
//#include "ATtinySerialOut.h"
7372
# if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
74-
# if defined(ARDUINO_AVR_DIGISPARK)
73+
# if defined(ARDUINO_AVR_DIGISPARK) // tested with 16 and 8 MHz
74+
//#include "ATtinySerialOut.h" // saves 370 bytes program space and 38 bytes RAM
7575
#define LED_BUILTIN PB1
7676
# endif
7777
#define IR_RECEIVE_PIN 0
7878
#define IR_SEND_PIN 4 // Pin 2 is serial output with ATtinySerialOut. Pin 1 is internal LED and Pin3 is USB+ with pullup on Digispark board.
7979
#define TONE_PIN 3
80-
//#define IR_TIMING_TEST_PIN 3
80+
#define IR_TIMING_TEST_PIN 3
8181

8282
# else
8383
// ATtiny87 + ATtiny167 here. For ATtiny167 Pins PB6 and PA3 are usable as interrupt source.

0 commit comments

Comments
 (0)