I want to communicate over serial to another device (dfplayer) and also set the microcontroller into sleep mode.
The ATtiny85 does not have a hardware serial pin so I need to use a virtual serial (like
I've googled a lot and tried a lot of things but it basically seems to come always to the same problem.
NeoSWSerial) do not work with
avr/sleep. Something to do with interrupts,
NeoSWSerial.cpp.o (symbol from plugin): In function
NeoSWSerial::read()': (.text+0x0): multiple definition of__vector_2' .pio\build\attiny85\src\main.cpp.o (symbol from plugin):(.text+0x0): first defined here
AltSoftSerial won't work because it requires a 16bit timer which the ATtiny does not have__
Is there anything I can do about this?
What I actually want to do
Connect 6 buttons with 6 different resistors to a single ADC pin of the controller. When a button is pressed wake up the device /if necessary), read the ADC value, pick a track based on that value and then play the track on the dfplayer.
After a while, if no button is pressed, put the dfplayer and the mcu to sleep. And that's why I need the mcu at all. You can't set the dfplayer to sleep or wake it up without serial
I confused SPI and Serial indeed. I need to use serial communication
I want to send and receive packages. Send:
InitializationFailed. And so on.Well it's some hex codes of course but you get the point I think
My flow should basiclly look like this:
boot/wakeup // <-- this is where I need the interrupt, don't I?
read adc value
pick track number based on adc value
send PlayTrack command to DFPlayer
delay x ms
send Sleep command to DFPlayer
go back to sleep
But the issue is in the combination of the Sleep and SoftwareSerial library. It's not the interrupt that is an issue. At least not yet