All I'm trying to do is to send the string below with ATTINY85. It compiles, but no data is sent
512,00.00,00.00,00,0,10001
If I compile the exactly same source-code with Arduino Uno/Nano, it works flawlessly.
Could you please help me figure out? If you have already a code which works, but uses different library, could you please share with me?
Thank you so much!
#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile
RH_ASK driver(2000, 4, 3); // 200bps, TX on D3 (pin 2)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
const char *msg = "512,00.00,00.00,00,0,10001";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
delay(2000);
}
Which ATtiny core are you using? Are you sure "Pin 3" is on the pin your radio is connected to? Are you sure you selected the 8 MHz clock rate? What are you using for a programmer?
RH_ASK works with ATTiny85, using Arduino 1.0.5 and tinycore from Google Code Archive - Long-term storage for Google Code Project Hosting. Tested with the examples ask_transmitter and ask_receiver on ATTiny85. Caution: The RAM memory requirements on an ATTiny85 are very tight. Even the bare bones ask_transmitter sketch barely fits in eh RAM available on the ATTiny85. Its unlikely to work on smaller ATTinys such as the ATTiny45 etc. If you have wierd behaviour, consider reducing the size of RH_ASK_MAX_PAYLOAD_LEN to the minimum you can work with. Caution: the default internal clock speed on an ATTiny85 is 1MHz. You MUST set the internal clock speed to 8MHz. You can do this with Arduino IDE, tineycore and ArduinoISP by setting the board type to "ATtiny85@8MHz', setting theProgrammer to 'Arduino as ISP' and selecting Tools->Burn Bootloader. This does not actually burn a bootloader into the tiny, it just changes the fuses so the chip runs at 8MHz. If you run the chip at 1MHz, you will get RK_ASK speeds 1/8th of the expected.
VirtualWire should indeed do the job if you keep things simple (doc states)
Caution: ATTiny85 has only 2 timers, one (timer 0) usually used for millis() and one (timer 1) for PWM analog outputs. The VirtualWire library, when built for ATTiny85, takes over timer 0, which prevents use of millis() etc but does permit analog outputs.
code could possibly be modified to use timer1 and you might want to shorten the buffer size to save ram
// At least for the ATTiny X4/X5, receiving has to be disabled due to
// missing libm depencies (udivmodhi4)
#if defined( __AVR_ATtinyX5__ ) or defined ( __AVR_ATtinyX4__ )
#define RCSwitchDisableReceiving
#endif