我正在使用Attiny85创建无线传感器。我想将数据发送到arduino uno,所以我从Spark Fun购买了315mhz rf链接套件。由于Attiny85没有TX,因此我决定使用曼彻斯特库,但是它不会在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