I bought a RTC real time clock module from sparkfun. I got it working with an arduino, but it is too big to strap to my wrist. I ordered a couple of ATTiny85 chips and I would like to shrink the project onto one of those. I finally got the blink sketch on the attiny, but I cannot get the RTC code onto it. I get a ton of errors like:
/Applications/Arduino.app/Contents/Resources/Java/libraries/Wire/utility/twi.c: In function 'twi_init':
/Applications/Arduino.app/Contents/Resources/Java/libraries/Wire/utility/twi.c:75: error: 'PORTD' undeclared (first use in this function)
/Applications/Arduino.app/Contents/Resources/Java/libraries/Wire/utility/twi.c:75: error: (Each undeclared identifier is reported only once
/Applications/Arduino.app/Contents/Resources/Java/libraries/Wire/utility/twi.c:75: error: for each function it appears in.)
/Applications/Arduino.app/Contents/Resources/Java/libraries/Wire/utility/twi.c:80: error: 'TWSR' undeclared (first use in this function)
/Applications/Arduino.app/Contents/Resources/Java/libraries/Wire/utility/twi.c:80: error: 'TWPS0' undeclared (first use in this function)
Anyideas?
I need to read the hours, and minutes off of the attiny.
I am only using a few pins. 1 pin is led, 2 pins are clock, 1 pin is button.
Thank you so much. I have been working on this since yesterday for so many hours and I am getting nowhere.
PORTD
ATtiny has only PORTB
Using Port Manipulation?
You have to use the ATtiny's pin numbers, you can't just re-use (copy&paste) those from your Duemilanove (et al.)
The IC's pin_5 = D0, pin_6 = D1, pin_7 = D2, pin_2 = D3, and pin_4 =D4
Hi, thanks for your reply, my problem isn't identifying the pins. It is the real time click liberty.
I just need a way to get the time from the RTC: DS1307.
There is a lib called TinyWireM that has an example sketch that talks to a RTC via its port address? But I dont get it. I tried using it and I dont know if it is working, all I know is when I try to assign one of my variables the value of hours and another variable the value of minutes I dont seem to be getting a response.
Have you configured it for the right speed as per the instructions?
What about the pullups?
I've just bought the same RTC module and am waiting for the post man to bring it so it will be interesting to see if I can get it to work with the attiny85.
Oh yes, sorry, that I did. No dice. It doesn't help that I dont understand how to hook up the LCD or serial monitor to this setup to get the error code.
All is compiling now. However:
After tweaking some code and adding some leds, I am convinced the attiny85 isn't even communicating with my RTC.
The mailman delivered my parts and I have this working.
I encountered issues with the LCD libraries and examples because they are LCD product specific
I had to rework them for more generic use and to include the reset fix but I haven't completed that task.
The LCD i'm using is a DFRobot I2C LCD and they are the best way to determine if your I2C is working on the attiny as they give a definite visual clue.
The code for the clock module is identical to code used for the Arduino uno. I just switched the wire and tinywireM
Apart from the unit not being enabled initially the only issues I had were getting the wires around the right way and remembering the pullups.
I am running a true 8mhz with correct fuses and boards info. I say that because it's very easy to think you have it configured correctly when it's not. One day someone will write an attiny diagnostic sketch to read out the fuse and prescaler settings.
I found the high low tech configuration was a bit troublesome to get the fuses set cleanly and had to spend a lot of time tweaking it to get it to work. I recommend not using it if you are starting out or stick to 1mHz.