I think I have a thinking Problem.
I am trying to find a Microcontroller, which is able to manage an H-Bridge (2 PWM Pins), manage a CNY70 Reflective Optical Sensor with Transistor Output via Interrupt and with which I can communicate with another Microcontroller via Serial or any other way! Is there any Microcontroller out there, which is able to do that? It would be perfect, if the controller is very small.
When I searched after small Microcontrollers, I found the ATtiny85, but I am not sure, if an ATtiny can do all this stuff?
Best regards
I think every microcontroller can do that. An 8-pin DIP might share many functions on the pins, you have to check the datasheet if you can combine the serial, interrupt and PWM on different pins.
The ATtiny85 could be a good choice. It is even made compatible with Arduino. Search for 'Trinket'.
Check the datasheet to see what the pins can do. I think it can do what you want, and more.
There is also a 8-pin DIP of a ARM processor. I think Adafruit.com has a development kit for it.
What is small ? The smd version of the ATmega328p is also small. Search for 'Arduino Pro Mini'. That is a very small board. If that is small enough, you have many pins, and the ATmega328p is the most common chip for Arduino projects.
Google is confusing me ...
On this picture from Communication with Tiny's, the Tiny dont uses a PWM Pin for the Serial Communication? In an other Thread in the Forum i read, that OC1B (PB4), OC0A (PB0), OC0B (PB1) are the three PWM pins.
Are the PWM outputs always the same, but inverted ? Then you can use a single Timer for that.
Perhaps these: pin 6 = OC1A, pin7 = /OC1A
or these: pin 3 = OC1B, pin 2 = /OC1B
To stop the motor, stop the timer and make both outputs low.
A serial port needs extra software. I think pin 5 and/or 6 can be used for that. But it can be done with software and a timer on other pins.
But if you do use 5 or 6, that means that the PWM can be used at pin 2 and 3.
Pin 7 for interrupt input. And one pin for a led.
I don't know about the ATtiny85 with a bootloader, but for other ATtiny chips, the reset is needed to program it. If it is only for a led, perhaps you better don't occupy the reset pin during development.
The bottom line is: The ATtiny85 can do too much. Others have explored many possibilities with combinations of software and the chip's hardware. I used the ATtiny13A, which is simple and straightforward, the ATtiny85 is for me just as confusing as for you.