Я создаю беспроводной датчик с помощью Attiny85. Я хочу отправить данные в arduino uno, поэтому я купил радиочастотный комплект 315 МГц у компании «Искра веселья». Поскольку у Attiny85 нет TX, я решил использовать библиотеку Manchester, однако она не будет компилироваться на Attiny85.
Я следовал инструкциям из этого блога: http://mchr3k-arduino.blogspot.mx/2012/01/wireless-sensor-node-part-2.html?showComment=1338749638806#c853067277980266192
Вот код, который я использую:
#include <WProgram.h> //otherwise it says it can't find Arduino.h
#include <Manchester.h> //include the library to comunicate
#define TxPin 2 //the pin that is used to send data
int sensorPin = 4;
int ledPin = 3;
int count = 50;
void setup(){
pinMode (ledPin, OUTPUT);
man.workAround1MhzTinyCore(); //add this in order for transmitter to work with 1Mhz Attiny85/84
man.setupTransmit(TxPin, MAN_1200); //set transimt pin
}
void loop(){
if (count == 50){
digitalWrite (ledPin, HIGH);
count = 0;
}
int data = analogRead(sensorPin);
man.transmit(data); //transmits and reads the data
delay (100);
count ++;
}
Вот сообщение об ошибке:
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp: In function 'void MANRX_SetupReceive(uint8_t)':
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:366: error: 'TCCR2A' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:366: error: 'WGM21' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:368: error: 'TCCR2B' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:368: error: 'CS21' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:369: error: 'OCR2A' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:379: error: 'TIMSK2' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:379: error: 'OCIE2A' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:380: error: 'TCNT2' was not declared in this scope